home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-2.iso / os2 / gnucal.zip / gcal_utl.c < prev    next >
C/C++ Source or Header  |  1995-12-20  |  124KB  |  3,545 lines

  1. /*
  2. *  gcal_utl.c:  Pool of common functions.
  3. *
  4. *
  5. *  Copyright (C) 1994, 1995 Thomas Esken
  6. *
  7. *  This software doesn't claim completeness, correctness or usability.
  8. *  On principle I will not be liable for any damages or losses (implicit
  9. *  or explicit), which result from using or handling my software.
  10. *  If you use this software, you agree without any exception to this
  11. *  agreement, which binds you LEGALLY !!
  12. *
  13. *  This program is free software; you can redistribute it and/or modify
  14. *  it under the terms of the `GNU General Public License' as published by
  15. *  the `Free Software Foundation'; either version 2, or (at your option)
  16. *  any later version.
  17. *
  18. *  You should have received a copy of the `GNU General Public License'
  19. *  along with this program; if not, write to the:
  20. *    Free Software Foundation
  21. *    59 Temple Place, Suite 330
  22. *    Boston, MA 02111-1307  USA
  23. */
  24.  
  25.  
  26.  
  27. #ifdef RCSID
  28. static char rcsid[]="$Id: gcal_utl.c 0.39 1995/12/20 00:03:09 tom Exp $";
  29. #endif
  30.  
  31.  
  32.  
  33. /*
  34. *  Include header files
  35. */
  36. #include "gcal_tai.h"
  37. #if HAVE_CTYPE_H
  38. #  include <ctype.h>
  39. #endif
  40. #if TIME_WITH_SYS_TIME
  41. #  include <sys/time.h>
  42. #  include <time.h>
  43. #else /* !TIME_WITH_SYS_TIME */
  44. #  if HAVE_SYS_TIME_H
  45. #    include <sys/time.h>
  46. #  else /* !HAVE_SYS_TIME_H */
  47. #    include <time.h>
  48. #  endif /* !HAVE_SYS_TIME_H */
  49. #endif /* !TIME_WITH_SYS_TIME */
  50. #include "gcal.h"
  51.  
  52.  
  53.  
  54. /*
  55. *  Function prototypes
  56. */
  57. #if __cplusplus
  58. extern "C"
  59. {
  60. #endif
  61. /*
  62. ************************************************** Defined in `gcal_hdy.c'
  63. */
  64. IMPORT int
  65. eval_holiday __P_((      int  day,
  66.                    const int  month,
  67.                    const int  year,
  68.                    const int  wd,
  69.                    const Bool forwards));
  70. #if USE_RC
  71. /*
  72. ************************************************** Defined in `gcal_rc.c'
  73. */
  74. IMPORT char *
  75. rc_get_date __P_((      char *ptr_char,
  76.                         Bool *is_weekday_mode,
  77.                         int  *d,
  78.                         int  *m,
  79.                         int  *y,
  80.                         int  *n,
  81.                         int  *len,
  82.                         char *hc,
  83.                         int  *hn,
  84.                         int  *hwd,
  85.                   const char *filename,
  86.                   const int   line,
  87.                   const char *line_buffer,
  88.                   const Bool  on_error_exit));
  89. IMPORT Bool
  90. precomp_nth_wd __P_((      int         diff,
  91.                      const int         wd,
  92.                            int        *n,
  93.                            int        *day,
  94.                            int        *month,
  95.                            int        *year,
  96.                      const Cmode_enum  mode));
  97. IMPORT Bool
  98. precomp_date __P_((      int         diff,
  99.                    const int         wd,
  100.                          int        *day,
  101.                          int        *month,
  102.                    const int         year,
  103.                    const Cmode_enum  mode));
  104. IMPORT void
  105. prev_date __P_((int *day,
  106.                 int *month,
  107.                 int *year));
  108. IMPORT void
  109. next_date __P_((int *day,
  110.                 int *month,
  111.                 int *year));
  112. #endif /* USE_RC */
  113. /*
  114. ************************************************** Defined in `gcal_tty.c'
  115. */
  116. IMPORT void
  117. print_text __P_((      FILE       *fp,
  118.                        char       *txt_line,
  119.                  const Dmode_enum  mode));
  120. /*
  121. ************************************************** Defined in `gcal_utl.c'
  122. */
  123. EXPORT void
  124. my_extended_help __P_((      FILE *fp,
  125.                        const int   longopt_symbolic));
  126. EXPORT void
  127. my_basic_help __P_((FILE *fp));
  128. EXPORT void
  129. my_license __P_((      FILE *fp,
  130.                  const char *prgr_id));
  131. EXPORT void
  132. my_version __P_((      FILE *fp,
  133.                  const char *prgr_id));
  134. EXPORT VOID_PTR
  135. my_malloc __P_((const int   amount,
  136.                 const int   exit_status,
  137.                 const char *module_name,
  138.                 const int   module_line,
  139.                 const char *var_name,
  140.                 const int   var_contents));
  141. EXPORT VOID_PTR
  142. my_realloc __P_((      VOID_PTR  ptr_memblock,
  143.                  const int       amount,
  144.                  const int       exit_status,
  145.                  const char     *module_name,
  146.                  const int       module_line,
  147.                  const char     *var_name,
  148.                  const int       var_contents));
  149. EXPORT void
  150. my_error __P_((const int   exit_status,
  151.                const char *module_name,
  152.                const int   module_line,
  153.                const char *var_name,
  154.                const int   var_contents));
  155. EXPORT int
  156. my_atoi __P_((const char *s));
  157. EXPORT Bool
  158. get_actual_date __P_((void));
  159. EXPORT int
  160. compare_d_m_name __P_((const char       *s,
  161.                        const Cmode_enum  mode));
  162. EXPORT int
  163. asc_sort __P_((const char **a,
  164.                const char **b));
  165. EXPORT int
  166. des_sort __P_((const char **a,
  167.                const char **b));
  168. EXPORT Bool
  169. is_presorted __P_((char **table,
  170.                    int    elems));
  171. EXPORT void
  172. resort __P_((      char **table,
  173.              const int    elems));
  174. #if !USE_GER
  175. EXPORT const char *
  176. day_suffix __P_((int day));
  177. EXPORT const char *
  178. short3_day_name __P_((const int day));
  179. #endif
  180. EXPORT const char *
  181. short_day_name __P_((const int day));
  182. EXPORT const char *
  183. day_name __P_((const int day));
  184. EXPORT const char *
  185. short_month_name __P_((const int month));
  186. EXPORT const char *
  187. month_name __P_((const int month));
  188. EXPORT Ulint
  189. date2num __P_((const int day,
  190.                const int month,
  191.                const int year));
  192. EXPORT Bool
  193. jdate2sdate __P_((      int  jdate,
  194.                   const int  is_leap_year,
  195.                         int *day,
  196.                         int *month));
  197. EXPORT int
  198. weekday_of_date __P_((const int day,
  199.                       const int month,
  200.                       const int year));
  201. EXPORT int
  202. day_of_year __P_((const int day,
  203.                   const int month,
  204.                   const int year));
  205. EXPORT int
  206. days_of_february __P_((const int year));
  207. EXPORT Bool
  208. valid_date __P_((const int day,
  209.                  const int month,
  210.                  const int year));
  211. EXPORT int
  212. week_number __P_((const int day,
  213.                   const int month,
  214.                   const int year));
  215. EXPORT int
  216. weekno2jday __P_((      int week,
  217.                   const int year));
  218. EXPORT int
  219. knuth_easter_formula __P_((const int year));
  220. EXPORT int
  221. julian_gregor_diff __P_((const int day,
  222.                          const int month,
  223.                          const int year));
  224. EXPORT const char *
  225. usage_msg __P_((void));
  226. EXPORT void
  227. put_longopt_description __P_((FILE *fp));
  228. LOCAL const char *
  229. get_longopt_description __P_((const int  longopt_symbolic,
  230.                               const Bool with_larglist));
  231. LOCAL void
  232. my_copyright __P_((      FILE *fp,
  233.                    const char *prgr_id));
  234. LOCAL void
  235. my_help_head_txt __P_((FILE *fp));
  236. LOCAL void
  237. my_help_tail_txt __P_((FILE *fp));
  238. LOCAL int
  239. raw_week_number __P_((const int day,
  240.                       const int month,
  241.                       const int year));
  242. #if __cplusplus
  243. }
  244. #endif
  245.  
  246.  
  247.  
  248. /*
  249. *  Declare public(extern) variables
  250. */
  251. IMPORT const int    dvec[MONTH_MAX];           /* Amount of days in months' */
  252. IMPORT const int    mvec[MONTH_MAX];           /* Number of past days of month */
  253. IMPORT const Lopt_struct  lopt[];              /* The longoption structure */
  254. IMPORT Hls_struct   ehls2s;                    /* Effective hls 2 start (holiday) */
  255. IMPORT Hls_struct   ehls2e;                    /* Effective hls 2 end (holiday) */
  256. IMPORT int          len_year_max;              /* String length of the maximum year able to compute */
  257. IMPORT int          act_sec;                   /* Actual second */
  258. IMPORT int          act_min;                   /* Actual minute */
  259. IMPORT int          act_hour;                  /* Actual hour */
  260. IMPORT int          act_day;                   /* Actual day */
  261. IMPORT int          act_month;                 /* Actual month */
  262. IMPORT int          act_year;                  /* Actual year */
  263. IMPORT int          buf_ad;                    /* Buffer of actual day */
  264. IMPORT int          buf_am;                    /* Buffer of actual month */
  265. IMPORT int          buf_ay;                    /* Buffer of actual year */
  266. IMPORT int          is_tty;                    /* Is output displayed on a terminal? */
  267. IMPORT int          len_prgr_name;             /* Length of actual program name */
  268. IMPORT char         s[MAXLEN+1];               /* General purpose text buffer */
  269. IMPORT char         s2[MAXLEN+1];              /* General purpose text buffer */
  270. IMPORT char        *prgr_name;                 /* Stores the actual program name */
  271. #ifdef GCAL_EPAGER
  272. IMPORT char        *ext_pager;                 /* Name of external pager program */
  273. #endif
  274. #if USE_RC
  275. IMPORT char        *rc_adate;                  /* Text containing modified actual date %... */
  276. #endif
  277. IMPORT Bool         emu_hls;                   /* Must we emulate the highlighting sequences? */
  278. IMPORT Bool         highlight_flag;            /* -H<yes> or -H<no> */
  279.  
  280.  
  281.  
  282. #ifdef ANSI_PROTO
  283. PUBLIC void
  284. my_extended_help (      FILE *fp,
  285.                   const int   longopt_symbolic)
  286. #else /* !ANSI_PROTO */
  287.    PUBLIC void
  288. my_extended_help (fp, longopt_symbolic)
  289.          FILE *fp;
  290.    const int   longopt_symbolic;
  291. #endif /* !ANSI_PROTO */
  292. /*
  293.    Prints the extended help text to file `fp' using the central
  294.      output function `print_text()' and uses global text buffer
  295.      `s' and `s2' internally.
  296.      if `longopt_symbolic' is set to SYM_NIL, the complete text
  297.      is shown, otherwise the text corresponding to SYM_??? only!
  298. */
  299. {
  300.    auto Bool  print_hls=(Bool)(is_tty&&highlight_flag&&!emu_hls);
  301.  
  302.  
  303.    if (longopt_symbolic == SYM_NIL)
  304.     {
  305.       my_help_head_txt (fp);
  306. #if USE_RC
  307. #  if USE_GER
  308.       sprintf(s, USAGE"%s [[OPTION...] [%cDATUM] [%cDATEI...]] [KOMMANDO]",
  309.               prgr_name, RC_ADATE_CHAR, RSP_CHAR);
  310. #  else /* !USE_GER */
  311.       sprintf(s, USAGE"%s [[OPTION...] [%cDATE] [%cFILE...]] [COMMAND]",
  312.               prgr_name, RC_ADATE_CHAR, RSP_CHAR);
  313. #  endif /* !USE_GER */
  314. #else /* !USE_RC */
  315. #  if USE_GER
  316.       sprintf(s, USAGE"%s [[OPTION...] [%cDATEI...]] [KOMMANDO]", prgr_name, RSP_CHAR);
  317. #  else /* !USE_GER */
  318.       sprintf(s, USAGE"%s [[OPTION...] [%cFILE...]] [COMMAND]", prgr_name, RSP_CHAR);
  319. #  endif /* !USE_GER */
  320. #endif /* !USE_RC */
  321.       print_text (fp, s, INternal);
  322.       print_text (fp, s, INternal);
  323.       print_text (fp, s, INternal);
  324.       if (print_hls)
  325.         strcpy(s, ehls2s.seq);
  326.       strcat(s, "OPTION");
  327.       if (print_hls)
  328.         strcat(s, ehls2e.seq);
  329.       print_text (fp, s, INternal);
  330.     }
  331. #if USE_GER
  332.    switch (longopt_symbolic)
  333.     {
  334.       case SYM_NIL:
  335.       case SYM_HELP:
  336.         sprintf(s, SWITCH"?        %s", get_longopt_description (SYM_HELP, TRUE));
  337.         print_text (fp, s, INternal);
  338.         sprintf(s, SWITCH"h        %s", get_longopt_description (SYM_HELP, TRUE));
  339.         print_text (fp, s, INternal);
  340.         strcpy(s, "          Hilfetext ausgeben und Programm beenden");
  341.         print_text (fp, s, INternal);
  342.         if (longopt_symbolic != SYM_NIL)
  343.           break;
  344.         print_text (fp, s, INternal);
  345.       case SYM_LONG_HELP1:
  346.       case SYM_LONG_HELP2:
  347.         sprintf(s, SWITCH"??       %s", get_longopt_description (SYM_LONG_HELP1, TRUE));
  348.         print_text (fp, s, INternal);
  349.         sprintf(s, SWITCH"hh       %s", get_longopt_description (SYM_LONG_HELP1, TRUE));
  350.         print_text (fp, s, INternal);
  351.         sprintf(s, "          %s", get_longopt_description (SYM_LONG_HELP2, TRUE));
  352.         print_text (fp, s, INternal);
  353.         strcpy(s, "          Erweiterten Hilfetext ausgeben und Programm beenden");
  354.         print_text (fp, s, INternal);
  355.         if (longopt_symbolic != SYM_NIL)
  356.           break;
  357.         print_text (fp, s, INternal);
  358.       case SYM_LICENSE1:
  359.       case SYM_LICENSE2:
  360.       case SYM_LICENSE3:
  361.         sprintf(s, SWITCH"L        %s", get_longopt_description (SYM_LICENSE1, TRUE));
  362.         print_text (fp, s, INternal);
  363.         sprintf(s, "          %s", get_longopt_description (SYM_LICENSE2, TRUE));
  364.         print_text (fp, s, INternal);
  365.         sprintf(s, "          %s", get_longopt_description (SYM_LICENSE3, TRUE));
  366.         print_text (fp, s, INternal);
  367.         strcpy(s, "          Softwarelizenz ausgeben und Programm beenden");
  368.         print_text (fp, s, INternal);
  369.         if (longopt_symbolic != SYM_NIL)
  370.           break;
  371.         print_text (fp, s, INternal);
  372.       case SYM_VERSION:
  373.         sprintf(s, SWITCH"V        %s", get_longopt_description (SYM_VERSION, TRUE));
  374.         print_text (fp, s, INternal);
  375.         strcpy(s, "          Versionsnummer ausgeben und Programm beenden");
  376.         print_text (fp, s, INternal);
  377.         if (longopt_symbolic != SYM_NIL)
  378.           break;
  379.         print_text (fp, s, INternal);
  380.       case SYM_RESPONSE_FILE:
  381.         sprintf(s, SWITCH"R ARG    %s", get_longopt_description (SYM_RESPONSE_FILE, TRUE));
  382.         print_text (fp, s, INternal);
  383.         sprintf(s, "          Antwortdatei f"UE"r die `%cDATEI' Option erzeugen", RSP_CHAR);
  384.         print_text (fp, s, INternal);
  385.         strcpy(s, "   ARG    = Schreibe Argumente der Kommandozeile in Datei ARG");
  386.         print_text (fp, s, INternal);
  387.         if (longopt_symbolic != SYM_NIL)
  388.           break;
  389.         print_text (fp, s, INternal);
  390. #  ifdef GCAL_SHELL
  391.       case SYM_SCRIPT_FILE:
  392.         sprintf(s, SWITCH"S ARG    %s", get_longopt_description (SYM_SCRIPT_FILE, TRUE));
  393.         print_text (fp, s, INternal);
  394.         sprintf(s, "          Shell script mit den Argumenten der Kommandozeile erzeugen");
  395.         print_text (fp, s, INternal);
  396.         strcpy(s, "   ARG    = Dateiname des shell scripts");
  397.         print_text (fp, s, INternal);
  398.         if (longopt_symbolic != SYM_NIL)
  399.           break;
  400.         print_text (fp, s, INternal);
  401. #endif
  402. #  if USE_RC
  403.       case SYM_DATE_VARIABLE1:
  404.       case SYM_DATE_VARIABLE2:
  405.         sprintf(s, SWITCH"v ARG    %s", get_longopt_description (SYM_DATE_VARIABLE1, TRUE));
  406.         print_text (fp, s, INternal);
  407.         sprintf(s, "          %s", get_longopt_description (SYM_DATE_VARIABLE2, TRUE));
  408.         print_text (fp, s, INternal);
  409.         strcpy(s, "          Globale Datumvariable(n) \"dvar->a|b|c|d|f|...|z\" definieren");
  410.         print_text (fp, s, INternal);
  411.         strcpy(s, "   ARG    = Durch `"SEP"' Zeichen getrennte Definitionen der "
  412.                "Form \"dvar"RC_DVAR_ASSIGN"`mmtt'\"");
  413.         print_text (fp, s, INternal);
  414.         strcpy(s, "            z.B.  "SWITCH"v a"RC_DVAR_ASSIGN"1127"SEP"b"RC_DVAR_ASSIGN
  415.                "054   Setze `a' auf 27 Nov und `b' auf 4 Mai");
  416.         print_text (fp, s, INternal);
  417.         if (longopt_symbolic != SYM_NIL)
  418.           break;
  419.         print_text (fp, s, INternal);
  420. #  endif
  421.       case SYM_DEBUG:
  422.         sprintf(s, "          %s", get_longopt_description (SYM_DEBUG, TRUE));
  423.         print_text (fp, s, INternal);
  424.         strcpy(s, "          Einige Debug-Informationen ausgeben");
  425.         print_text (fp, s, INternal);
  426.         strcpy(s, "  [ARG]   = internal    Warnungen bei Erreichen programminterner Maxima");
  427.         print_text (fp, s, INternal);
  428.         strcpy(s, "          = handled     Wie `internal' und zudem gehandhabte Dateinamen");
  429.         print_text (fp, s, INternal);
  430.         strcpy(s, "          = unhandled   Wie `internal' und zudem nicht gehandhabte Dateinamen");
  431.         print_text (fp, s, INternal);
  432.         strcpy(s, "          = all         Wie `handled' und `unhandled' zusammen");
  433.         print_text (fp, s, INternal);
  434.         strcpy(s, "          = abort       Wie `all' und Abbruch bei ungehandhabten Dateinamen");
  435.         print_text (fp, s, INternal);
  436.         if (longopt_symbolic != SYM_NIL)
  437.           break;
  438.         print_text (fp, s, INternal);
  439.       case SYM_TYPE_OF_CALENDAR:
  440.         sprintf(s, SWITCH"i[MOD]   %s", get_longopt_description (SYM_TYPE_OF_CALENDAR, TRUE));
  441.         print_text (fp, s, INternal);
  442.         strcpy(s, "          Spezial-Kalenderformat f"UE"r Kalenderblatt verwenden");
  443.         print_text (fp, s, INternal);
  444.         strcat(s, "  [MOD]   = -   Standard-Kalenderformat f"UE"r Kalenderblatt verwenden");
  445.         print_text (fp, s, INternal);
  446.         if (longopt_symbolic != SYM_NIL)
  447.           break;
  448.         print_text (fp, s, INternal);
  449.       case SYM_SUPPRESS_CALENDAR:
  450.         sprintf(s, SWITCH"u        %s", get_longopt_description (SYM_SUPPRESS_CALENDAR, TRUE));
  451.         print_text (fp, s, INternal);
  452.         strcpy(s, "          Ausgabe des Kalenderblatts explizit unterdr"UE"cken");
  453.         print_text (fp, s, INternal);
  454.         if (longopt_symbolic != SYM_NIL)
  455.           break;
  456.         print_text (fp, s, INternal);
  457. #  if USE_PAGER
  458.       case SYM_PAGER:
  459.         sprintf(s, SWITCH"p        %s", get_longopt_description (SYM_PAGER, TRUE));
  460.         print_text (fp, s, INternal);
  461. #    ifdef GCAL_EPAGER
  462.         if (ext_pager != (char *)NULL)
  463.           sprintf(s, "          Ausgabe durch externen `%s' Paginierer lenken",
  464.                   (*ext_pager == *DIR_SEP) ? strrchr(ext_pager, *DIR_SEP)+1 : ext_pager);
  465.         else
  466.           strcpy(s, "          Ausgabe durch einfachen, internen Paginierer lenken");
  467. #    else /* !GCAL_EPAGER */
  468.         strcpy(s, "          Ausgabe durch einfachen, internen Paginierer lenken");
  469. #    endif /* !GCAL_EPAGER */
  470.         print_text (fp, s, INternal);
  471.         if (longopt_symbolic != SYM_NIL)
  472.           break;
  473.         print_text (fp, s, INternal);
  474. #  endif
  475.       case SYM_DISABLE_HIGHLIGHTING:
  476.         sprintf(s, SWITCH"H no     %s", get_longopt_description (SYM_DISABLE_HIGHLIGHTING, TRUE));
  477.         print_text (fp, s, INternal);
  478.         sprintf(s, "          %s=no",  get_longopt_description (SYM_HIGHLIGHTING, FALSE));
  479.         print_text (fp, s, INternal);
  480.         strcpy(s, "          Text, Feiertag bzw. aktuelles Datum ohne Hervorhebung ausgeben");
  481.         print_text (fp, s, INternal);
  482.         if (longopt_symbolic != SYM_NIL)
  483.           break;
  484.         print_text (fp, s, INternal);
  485.       case SYM_FORCE_HIGHLIGHTING:
  486.         sprintf(s, SWITCH"H yes    %s", get_longopt_description (SYM_FORCE_HIGHLIGHTING, TRUE));
  487.         print_text (fp, s, INternal);
  488.         sprintf(s, "          %s=yes",  get_longopt_description (SYM_HIGHLIGHTING, FALSE));
  489.         print_text (fp, s, INternal);
  490.         strcpy(s, "          Bel"AE"sst Hervorhebungssequenzen in Ausgabe bei Ausgabeumlenkung");
  491.         print_text (fp, s, INternal);
  492.         if (longopt_symbolic != SYM_NIL)
  493.           break;
  494.         print_text (fp, s, INternal);
  495.       case SYM_HIGHLIGHTING:
  496.         sprintf(s, SWITCH"H ARG    %s", get_longopt_description (SYM_HIGHLIGHTING, TRUE));
  497.         print_text (fp, s, INternal);
  498.         strcpy(s, "          Setze Hervorhebungssequenz-Paare 1 (=aktueller Tag) und 2 (=Feiertag)");
  499.         print_text (fp, s, INternal);
  500.         strcpy(s, "   ARG    = Durch `"SEP"' Zeichen getrennte Hervorhebungssequenz-Paare");
  501.         print_text (fp, s, INternal);
  502.         strcpy(s, "            z.B.  "SWITCH"H \\x2"SEP"\\x"
  503.                "AE   Benutze Hex-Wert 2 und AE f"UE"r Sequenz 1");
  504.         print_text (fp, s, INternal);
  505.         strcpy(s, "            z.B.  "SWITCH"H "SEP""SEP"*"SEP
  506.                "*      Benutze Zeichen `*' und `*' f"UE"r Sequenz 2");
  507.         print_text (fp, s, INternal);
  508.         if (longopt_symbolic != SYM_NIL)
  509.           break;
  510.         print_text (fp, s, INternal);
  511.       case SYM_BLOCKS:
  512.         sprintf(s, SWITCH"b ARG    %s", get_longopt_description (SYM_BLOCKS, TRUE));
  513.         print_text (fp, s, INternal);
  514.         strcpy(s, "          Format des Jahreskalenders festlegen");
  515.         print_text (fp, s, INternal);
  516.         strcpy(s, "   ARG    = 1|2|3|4|6|12   Anzahl der Bl"OE"cke");
  517.         print_text (fp, s, INternal);
  518.         if (longopt_symbolic != SYM_NIL)
  519.           break;
  520.         print_text (fp, s, INternal);
  521.       case SYM_CALENDAR_DATES:
  522.         sprintf(s, SWITCH"j[MOD]   %s", get_longopt_description (SYM_CALENDAR_DATES, TRUE));
  523.         print_text (fp, s, INternal);
  524.         strcpy(s, "          Julianisches Datum im Kalenderblatt verwenden");
  525.         print_text (fp, s, INternal);
  526.         strcpy(s, "  [MOD]   = b   Beide Datumnotationen (Standard + Julianisch) verwenden");
  527.         print_text (fp, s, INternal);
  528.         if (longopt_symbolic != SYM_NIL)
  529.           break;
  530.         print_text (fp, s, INternal);
  531.       case SYM_HOLIDAY_DATES:
  532.         sprintf(s, SWITCH"jn[MOD]  %s", get_longopt_description (SYM_HOLIDAY_DATES, TRUE));
  533.         print_text (fp, s, INternal);
  534.         strcpy(s, "          Julianisches Datum in ewiger Feiertagsliste verwenden");
  535.         print_text (fp, s, INternal);
  536.         strcpy(s, "   [MOD]  = b   Beide Datumnotationen (Standard + Julianisch) verwenden");
  537.         print_text (fp, s, INternal);
  538.         if (longopt_symbolic != SYM_NIL)
  539.           break;
  540.         print_text (fp, s, INternal);
  541. #if USE_RC
  542.       case SYM_FIXED_DATES:
  543.         sprintf(s, SWITCH"jc[MOD]  %s", get_longopt_description (SYM_FIXED_DATES, TRUE));
  544.         print_text (fp, s, INternal);
  545.         strcpy(s, "          Julianisches Datum in Terminwarnungsliste verwenden");
  546.         print_text (fp, s, INternal);
  547.         strcpy(s, "   [MOD]  = b   Beide Datumnotationen (Standard + Julianisch) verwenden");
  548.         print_text (fp, s, INternal);
  549.         if (longopt_symbolic != SYM_NIL)
  550.           break;
  551.         print_text (fp, s, INternal);
  552. #endif
  553.       case SYM_STARTING_DAY:
  554.         sprintf(s, SWITCH"s ARG    %s", get_longopt_description (SYM_STARTING_DAY, TRUE));
  555.         print_text (fp, s, INternal);
  556.         strcpy(s, "          Starttag der Woche festlegen");
  557.         print_text (fp, s, INternal);
  558.         sprintf(s, "   ARG    = 0 | %d|%s|%d|%s|...|%d|%s",
  559.                 DAY_MIN, short_day_name (DAY_MIN),
  560.                 DAY_MIN+1, short_day_name (DAY_MIN+1),
  561.                 DAY_MAX, short_day_name (DAY_MAX));
  562.         print_text (fp, s, INternal);
  563.         if (longopt_symbolic != SYM_NIL)
  564.           break;
  565.         print_text (fp, s, INternal);
  566. #  ifdef GCAL_EMAIL
  567.       case SYM_MAIL:
  568.         sprintf(s, SWITCH"m ARG    %s", get_longopt_description (SYM_MAIL, TRUE));
  569.         print_text (fp, s, INternal);
  570.         strcpy(s, "          Versenden der Ausgabe via `"MAIL_PRGR"' Programm an Benutzer");
  571.         print_text (fp, s, INternal);
  572.         strcpy(s, "   ARG    = Email Adresse");
  573.         print_text (fp, s, INternal);
  574.         if (longopt_symbolic != SYM_NIL)
  575.           break;
  576.         print_text (fp, s, INternal);
  577. #  endif
  578.       case SYM_DESC_HOLIDAY_LIST:
  579.       case SYM_HOLIDAY_LIST:
  580.         sprintf(s, SWITCH"n|N[MOD] %s", get_longopt_description (SYM_DESC_HOLIDAY_LIST, TRUE));
  581.         print_text (fp, s, INternal);
  582.         sprintf(s, "          %s", get_longopt_description (SYM_HOLIDAY_LIST, TRUE));
  583.         print_text (fp, s, INternal);
  584.         sprintf(s, "          Ewige Feiertagsliste ausgeben "
  585.                 "(Jahr im Bereich: %d...%d)", EASTER_MIN, EASTER_MAX);
  586.         print_text (fp, s, INternal);
  587.         strcpy(s, " n        = Gesetzliche Feiertage und Erinnerungstage");
  588.         print_text (fp, s, INternal);
  589.         strcpy(s, "   N      = Nur gesetzliche Feiertage");
  590.         print_text (fp, s, INternal);
  591.         strcpy(s, "    [MOD] = "DES_LIT"   Absteigend sortiert");
  592.         print_text (fp, s, INternal);
  593.         if (longopt_symbolic != SYM_NIL)
  594.           break;
  595.         print_text (fp, s, INternal);
  596.       case SYM_EXCLUDE_HD_TITLE:
  597.         sprintf(s, SWITCH"X        %s", get_longopt_description (SYM_EXCLUDE_HD_TITLE, TRUE));
  598.         print_text (fp, s, INternal);
  599.         strcpy(s, "          Ewige Feiertagsliste ohne "UUE"berschrift ausgeben");
  600.         print_text (fp, s, INternal);
  601.       default:
  602.         ;   /* Void */
  603.     }
  604. #  if USE_RC
  605.    if (longopt_symbolic == SYM_NIL)
  606.     {
  607.       print_text (fp, s, INternal);
  608.       sprintf(s, "+++ TERMINWARNUNGEN +++");
  609.       print_text (fp, s, INternal);
  610.       print_text (fp, s, INternal);
  611.     }
  612.    switch (longopt_symbolic)
  613.     {
  614.       case SYM_NIL:
  615.       case SYM_LIST_OF_FIXED_DATES:
  616.         sprintf(s, SWITCH"c|C[MOD] %s", get_longopt_description (SYM_LIST_OF_FIXED_DATES, TRUE));
  617.         print_text (fp, s, INternal);
  618.         strcpy(s, "          Benutze Standard Resourcendatei `"PRGR_RC_NAME"' f"UE"r Terminliste");
  619.         print_text (fp, s, INternal);
  620.         strcpy(s, "          Impliziert Warnungszeitraum:  Heute");
  621.         print_text (fp, s, INternal);
  622.         strcpy(s, " c        = Nur die Daten ausgeben, zu denen Termine vorliegen");
  623.         print_text (fp, s, INternal);
  624.         strcpy(s, "   C      = Auch die Daten ausgeben, zu denen keine Termine vorliegen");
  625.         print_text (fp, s, INternal);
  626.       default:
  627.         ;   /* Void */
  628.     }
  629.    if (longopt_symbolic == SYM_NIL)
  630.     {
  631.       strcpy(s, "    [MOD] = Einer oder mehr der folgenden Modifizierer; hier markiert mit #");
  632.       print_text (fp, s, INternal);
  633.       print_text (fp, s, INternal);
  634.     }
  635.    switch (longopt_symbolic)
  636.     {
  637.       case SYM_NIL:
  638.       case SYM_GROUPING_TEXT:
  639.         sprintf(s, "          %s", get_longopt_description (SYM_GROUPING_TEXT, TRUE));
  640.         print_text (fp, s, INternal);
  641.         strcpy(s, "          # g[MOD]       = Benutze Trenntext MOD f"UE"r tageweise Gruppierung");
  642.         print_text (fp, s, INternal);
  643.         print_text (fp, s, INternal);
  644.       default:
  645.         ;   /* Void */
  646.     }
  647.    if (longopt_symbolic == SYM_NIL)
  648.     {
  649.       print_text (fp, s, INternal);
  650.       strcpy(s, "          1. Sortierordnung des Textes");
  651.       print_text (fp, s, INternal);
  652.     }
  653.    switch (longopt_symbolic)
  654.     {
  655.       case SYM_NIL:
  656.       case SYM_DESC_FIXED_DATES:
  657.         sprintf(s, "          %s", get_longopt_description (SYM_DESC_FIXED_DATES, TRUE));
  658.         print_text (fp, s, INternal);
  659.         strcpy(s, "          # "DES_LIT"            = Absteigend sortiert");
  660.         print_text (fp, s, INternal);
  661.       default:
  662.         ;   /* Void */
  663.     }
  664.    if (longopt_symbolic == SYM_NIL)
  665.     {
  666.       print_text (fp, s, INternal);
  667.       strcpy(s, "          2. Darstellung des Textes");
  668.       print_text (fp, s, INternal);
  669.     }
  670.    switch (longopt_symbolic)
  671.     {
  672.       case SYM_NIL:
  673.       case SYM_INCLUDE_FILENAME:
  674.         sprintf(s, "          %s", get_longopt_description (SYM_INCLUDE_FILENAME, TRUE));
  675.         print_text (fp, s, INternal);
  676.         strcpy(s, "          # a            = Herkunft der Terminwarnung ausgeben");
  677.         print_text (fp, s, INternal);
  678.         if (longopt_symbolic != SYM_NIL)
  679.           break;
  680.         print_text (fp, s, INternal);
  681.       case SYM_INCLUDE_HOLIDAY:
  682.         sprintf(s, "          %s", get_longopt_description (SYM_INCLUDE_HOLIDAY, TRUE));
  683.         print_text (fp, s, INternal);
  684.         strcpy(s, "          # e            = Gesetzliche Feiertage und Erinnerungstage einf"UE"gen");
  685.         print_text (fp, s, INternal);
  686.         strcpy(s, "          # E            = Nur gesetzliche Feiertage einf"UE"gen");
  687.         print_text (fp, s, INternal);
  688.         if (longopt_symbolic != SYM_NIL)
  689.           break;
  690.         print_text (fp, s, INternal);
  691.       case SYM_INCLUDE_WEEK_NO:
  692.         sprintf(s, "          %s", get_longopt_description (SYM_INCLUDE_WEEK_NO, TRUE));
  693.         print_text (fp, s, INternal);
  694.         strcpy(s, "          # k            = ISO-Wochennummer ausgeben");
  695.         print_text (fp, s, INternal);
  696.         if (longopt_symbolic != SYM_NIL)
  697.           break;
  698.         print_text (fp, s, INternal);
  699.       case SYM_OMIT_DATE_PART:
  700.         sprintf(s, "          %s", get_longopt_description (SYM_OMIT_DATE_PART, TRUE));
  701.         print_text (fp, s, INternal);
  702.         strcpy(s, "          # o            = Datumfeld nur einmal ausgeben");
  703.         print_text (fp, s, INternal);
  704.         if (longopt_symbolic != SYM_NIL)
  705.           break;
  706.         print_text (fp, s, INternal);
  707.       case SYM_EXCLUDE_RC_TITLE:
  708.         sprintf(s, "          %s", get_longopt_description (SYM_EXCLUDE_RC_TITLE, TRUE));
  709.         print_text (fp, s, INternal);
  710.         strcpy(s, "          # x            = Terminwarnungsliste ohne "UUE"berschrift ausgeben");
  711.         print_text (fp, s, INternal);
  712.         if (longopt_symbolic != SYM_NIL)
  713.           break;
  714.         print_text (fp, s, INternal);
  715.       case SYM_INCLUDE_CONS_NO:
  716.         sprintf(s, "          %s", get_longopt_description (SYM_INCLUDE_CONS_NO, TRUE));
  717.         print_text (fp, s, INternal);
  718.         strcpy(s, "          # z            = Laufende Postennummer ausgeben");
  719.         print_text (fp, s, INternal);
  720.       default:
  721.         ;   /* Void */
  722.     }
  723.    if (longopt_symbolic == SYM_NIL)
  724.     {
  725.       print_text (fp, s, INternal);
  726.       strcpy(s, "          3. Warnungszeitraum");
  727.       print_text (fp, s, INternal);
  728.     }
  729.    switch (longopt_symbolic)
  730.     {
  731.       case SYM_NIL:
  732.       case SYM_INCLUDE_TODAY:
  733.         sprintf(s, "          %s", get_longopt_description (SYM_INCLUDE_TODAY, TRUE));
  734.         print_text (fp, s, INternal);
  735.         strcpy(s, "          # d            = Aktuelles Datum einschliessen bei Datumliste");
  736.         print_text (fp, s, INternal);
  737.         if (longopt_symbolic != SYM_NIL)
  738.           break;
  739.         print_text (fp, s, INternal);
  740.       case SYM_LIST_MODE:
  741.         sprintf(s, "          %s", get_longopt_description (SYM_LIST_MODE, TRUE));
  742.         print_text (fp, s, INternal);
  743.         strcpy(s, "          # l            = Datumliste anstelle Einzeldatum");
  744.         print_text (fp, s, INternal);
  745.         if (longopt_symbolic != SYM_NIL)
  746.           break;
  747.         print_text (fp, s, INternal);
  748.       default:
  749.         ;   /* Void */
  750.     }
  751.    switch (longopt_symbolic)
  752.     {
  753.       case SYM_NIL:
  754.       case SYM_PERIOD:
  755.         sprintf(s, "          %s", get_longopt_description (SYM_PERIOD, TRUE));
  756.         print_text (fp, s, INternal);
  757.         strcpy(s, "          # Nd           = Einzelner absoluter Tag N");
  758.         print_text (fp, s, INternal);
  759.         sprintf(s, "          # %cdN          = Einzelner absoluter Tag N",
  760.                 RC_NWD_CHAR);
  761.         print_text (fp, s, INternal);
  762.         print_text (fp, s, INternal);
  763.         strcpy(s, "          # NMOD         = Einzelner Tag N relativ zu heute");
  764.         print_text (fp, s, INternal);
  765.         strcpy(s, "             MOD           = "ASC_LIT"   Vorw"AE"rts");
  766.         print_text (fp, s, INternal);
  767.         strcpy(s, "                           = "DES_LIT"   R"UE"ckw"AE"rts");
  768.         print_text (fp, s, INternal);
  769.         print_text (fp, s, INternal);
  770.         strcpy(s, "          # Nw           = Gesamte Woche N");
  771.         print_text (fp, s, INternal);
  772.         strcpy(s, "                           N = 0        1'te Woche / letzte Woche im Vorjahr");
  773.         print_text (fp, s, INternal);
  774.         strcpy(s, "                           N = 1...52   1'te...52'te Woche (stets)");
  775.         print_text (fp, s, INternal);
  776.         strcpy(s, "                           N = 53       53'te Woche (manchmal)");
  777.         print_text (fp, s, INternal);
  778.         strcpy(s, "                           N = 99       Letzte Woche");
  779.         print_text (fp, s, INternal);
  780.         print_text (fp, s, INternal);
  781.         strcpy(s, "          # `mmtt'       = Einzelner Tag `tt' im Monat `mm'");
  782.         print_text (fp, s, INternal);
  783.         print_text (fp, s, INternal);
  784.         strcpy(s, "          # `mmwww'N     = Einzelner N'ter Wochentag `www' im Monat `mm'");
  785.         print_text (fp, s, INternal);
  786.         strcpy(s, "                           N = 1...4   1'ter...4'ter Wochentag `www' (stets)");
  787.         print_text (fp, s, INternal);
  788.         strcpy(s, "                           N = 5       5'ter Wochentag `www' (manchmal)");
  789.         print_text (fp, s, INternal);
  790.         strcpy(s, "                           N = 9       Letzter Wochentag `www'");
  791.         print_text (fp, s, INternal);
  792.         print_text (fp, s, INternal);
  793.         sprintf(s, "          # %cdN`www'     = Einzelner N'ter Wochentag `www'",
  794.                 RC_NWD_CHAR);
  795.         print_text (fp, s, INternal);
  796.         strcpy(s, "                           N = 1...51   1'ter...51'ter Wochentag `www' (stets)");
  797.         print_text (fp, s, INternal);
  798.         strcpy(s, "                           N = 52|53    52|53'ter Wochentag `www' (manchmal)");
  799.         print_text (fp, s, INternal);
  800.         strcpy(s, "                           N = 99       Letzter Wochentag `www'");
  801.         print_text (fp, s, INternal);
  802.         print_text (fp, s, INternal);
  803.         sprintf(s, "          # %cwN`www'     = Einzelner Wochentag `www' der N'ten Woche",
  804.                 RC_NWD_CHAR);
  805.         print_text (fp, s, INternal);
  806.         strcpy(s, "                           N = 0        `www' der nicht in der 1'ten Woche ist");
  807.         print_text (fp, s, INternal);
  808.         strcpy(s, "                           N = 1...51   `www' der 1'ten...51'ten Woche (stets)");
  809.         print_text (fp, s, INternal);
  810.         strcpy(s, "                           N = 52|53    `www' der 52|53'ten Woche (manchmal)");
  811.         print_text (fp, s, INternal);
  812.         strcpy(s, "                           N = 99       `www' der letzten Woche");
  813.         print_text (fp, s, INternal);
  814.         print_text (fp, s, INternal);
  815.         sprintf(s, "          # %ce[["ASC_LIT"|"DES_LIT"]N]   = "
  816.                 "Einzelner Tag N relativ zu Ostersonntag", RC_HDY_CHAR);
  817.         print_text (fp, s, INternal);
  818.         print_text (fp, s, INternal);
  819.         sprintf(s, "          # %ce["ASC_LIT"|"DES_LIT"]N`www'= "
  820.                 "Einzelner N'ter Wochentag relativ zu Ostersonntag", RC_HDY_CHAR);
  821.         print_text (fp, s, INternal);
  822.         print_text (fp, s, INternal);
  823.         sprintf(s, "          # %cv[["ASC_LIT"|"DES_LIT"]N]   = "
  824.                 "Einzelner Tag N relativ zur Datumvariablen", RC_HDY_CHAR);
  825.         print_text (fp, s, INternal);
  826.         print_text (fp, s, INternal);
  827.         sprintf(s, "          # %cv["ASC_LIT"|"DES_LIT"]N`www'= "
  828.                 "Einzelner N'ter Wochentag relativ zur Datumvariablen", RC_HDY_CHAR);
  829.         print_text (fp, s, INternal);
  830.         print_text (fp, s, INternal);
  831.         strcpy(s, "          # t|T          = Datumliste von morgen");
  832.         print_text (fp, s, INternal);
  833.         print_text (fp, s, INternal);
  834.         strcpy(s, "          # w|W[MOD]     = Datumliste der gesamten Woche");
  835.         print_text (fp, s, INternal);
  836.         strcpy(s, "               [MOD]       = "ASC_LIT"   Liste von morgen bis Ende der Woche");
  837.         print_text (fp, s, INternal);
  838.         strcpy(s, "                           = "DES_LIT"   Liste von gestern bis Anfang der Woche");
  839.         print_text (fp, s, INternal);
  840.         print_text (fp, s, INternal);
  841.         strcpy(s, "          # m|M[MOD]     = Datumliste des gesamten Monats");
  842.         print_text (fp, s, INternal);
  843.         strcpy(s, "               [MOD]       = "ASC_LIT"   Liste von morgen bis Ende des Monats");
  844.         print_text (fp, s, INternal);
  845.         strcpy(s, "                           = "DES_LIT"   Liste von gestern bis Anfang der Monats");
  846.         print_text (fp, s, INternal);
  847.         print_text (fp, s, INternal);
  848.         strcpy(s, "          # y|Y[MOD]     = Liste des gesamten Jahres");
  849.         print_text (fp, s, INternal);
  850.         strcpy(s, "               [MOD]       = "ASC_LIT"   Liste von morgen bis Ende des Jahres");
  851.         print_text (fp, s, INternal);
  852.         strcpy(s, "                           = "DES_LIT"   Liste von gestern bis Anfang des Jahres");
  853.         print_text (fp, s, INternal);
  854.         if (longopt_symbolic != SYM_NIL)
  855.           break;
  856.         print_text (fp, s, INternal);
  857.       case SYM_RESOURCE_FILE:
  858.         sprintf(s, SWITCH"f|F ARG  %s", get_longopt_description (SYM_RESOURCE_FILE, TRUE));
  859.         print_text (fp, s, INternal);
  860.         strcpy(s, "          Benutze alternative Datei(en) anstelle Standard Resourcendatei");
  861.         print_text (fp, s, INternal);
  862.         strcpy(s, "          Impliziert Warnungszeitraum:  Heute");
  863.         print_text (fp, s, INternal);
  864.         strcpy(s, " f        = Nur die Daten ausgeben, zu denen Termine vorliegen");
  865.         print_text (fp, s, INternal);
  866.         strcpy(s, "   F      = Auch die Daten ausgeben, zu denen keine Termine vorliegen");
  867.         print_text (fp, s, INternal);
  868.         strcpy(s, "     ARG  = Einzelne Datei oder durch `"RC_FNAME_SEP
  869.                "' Zeichen separierte Liste von Dateien");
  870.         print_text (fp, s, INternal);
  871.       default:
  872.           ;   /* Void */
  873.     }
  874.    if (longopt_symbolic == SYM_NIL)
  875.     {
  876.       print_text (fp, s, INternal);
  877.       print_text (fp, s, INternal);
  878.       if (print_hls)
  879.         strcpy(s, ehls2s.seq);
  880.       sprintf(s2, "%cDATUM", RC_ADATE_CHAR);
  881.       strcat(s, s2);
  882.       if (print_hls)
  883.         strcat(s, ehls2e.seq);
  884.       print_text (fp, s, INternal);
  885.       strcpy(s, "Vorgegebenes `DATUM' anstelle des heutigen Datums verwenden");
  886.       print_text (fp, s, INternal);
  887.       sprintf(s, "Datumformat:  `"Y_LIT2"[mm[tt|www[N]]]', `"Y_LIT2"%c%c|dvar[["ASC_LIT"|"
  888.               DES_LIT"]N[www]]', `"Y_LIT2"%cdN[www]'", RC_HDY_CHAR, RC_EASTER_CHAR, RC_NWD_CHAR);
  889.       print_text (fp, s, INternal);
  890.       sprintf(s, "              `"Y_LIT2"%cwN[www]', `Monatsname[tt]', `Wochentagsname[N]'"
  891.               " oder `tt'", RC_NWD_CHAR);
  892.       print_text (fp, s, INternal);
  893.     }
  894. #  endif /* USE_RC */
  895.    if (longopt_symbolic == SYM_NIL)
  896.     {
  897.       print_text (fp, s, INternal);
  898.       print_text (fp, s, INternal);
  899.       if (print_hls)
  900.         strcpy(s, ehls2s.seq);
  901.       sprintf(s2, "%cDATEI", RSP_CHAR);
  902.       strcat(s, s2);
  903.       if (print_hls)
  904.         strcat(s, ehls2e.seq);
  905.       print_text (fp, s, INternal);
  906.       strcpy(s, "L"AE"dt Optionen und Kommandos aus `DATEI' vor");
  907.       print_text (fp, s, INternal);
  908.       print_text (fp, s, INternal);
  909.       print_text (fp, s, INternal);
  910.       if (print_hls)
  911.         strcpy(s, ehls2s.seq);
  912.       strcat(s, "KOMMANDO");
  913.       if (print_hls)
  914.         strcat(s, ehls2e.seq);
  915.       print_text (fp, s, INternal);
  916.       sprintf(s, "mm       = Monat im Bereich:  %d...%d", MONTH_MIN, MONTH_MAX);
  917.       print_text (fp, s, INternal);
  918.       strcpy (s, "                       oder:  Monatsname | "MONTH3_LIT" | "
  919.               MONTH3_LIT""MONTH3_LIT" | "MONTH3_LIT""ASC_LIT" | "MONTH3_LIT""DES_LIT);
  920.       print_text (fp, s, INternal);
  921.       print_text (fp, s, INternal);
  922.       strcpy(s, "           Liste:    mm["YEAR_SEP""Y_LIT2"]"
  923.              MLIST_SEP"..."MLIST_SEP"mm["YEAR_SEP""Y_LIT2"]");
  924.       print_text (fp, s, INternal);
  925.       strcpy(s, "           Bereich:  mm["YEAR_SEP""Y_LIT2"]"
  926.              MRANGE_SEP"mm["YEAR_SEP""Y_LIT2"]");
  927.       print_text (fp, s, INternal);
  928.       print_text (fp, s, INternal);
  929.       sprintf(s, Y_LIT2"     = Jahr  im Bereich:  %d...%d", YEAR_MIN, YEAR_MAX);
  930.       print_text (fp, s, INternal);
  931.       print_text (fp, s, INternal);
  932.       strcpy(s, "           Liste:    [mm"FYEAR_SEP"]"Y_LIT2
  933.              ""YLIST_SEP"..."YLIST_SEP"[mm"FYEAR_SEP"]"Y_LIT2);
  934.       print_text (fp, s, INternal);
  935.       strcpy(s, "           Bereich:  [mm"FYEAR_SEP"]"Y_LIT2
  936.              ""YRANGE_SEP"[mm"FYEAR_SEP"]"Y_LIT2);
  937.       print_text (fp, s, INternal);
  938.       print_text (fp, s, INternal);
  939.       print_text (fp, s, INternal);
  940.       sprintf(s, "   +++ Bei zweistelliger Jahresangabe wird NICHT"
  941.               " von %2d"Y_LIT" ausgegangen +++", act_year/100);
  942.     }
  943. #else /* !USE_GER */
  944.    switch (longopt_symbolic)
  945.     {
  946.       case SYM_NIL:
  947.       case SYM_HELP:
  948.         sprintf(s, SWITCH"?        %s", get_longopt_description (SYM_HELP, TRUE));
  949.         print_text (fp, s, INternal);
  950.         sprintf(s, SWITCH"h        %s", get_longopt_description (SYM_HELP, TRUE));
  951.         print_text (fp, s, INternal);
  952.         strcpy(s, "          Display help text and quit program");
  953.         print_text (fp, s, INternal);
  954.         if (longopt_symbolic != SYM_NIL)
  955.           break;
  956.         print_text (fp, s, INternal);
  957.       case SYM_LONG_HELP1:
  958.       case SYM_LONG_HELP2:
  959.         sprintf(s, SWITCH"??       %s", get_longopt_description (SYM_LONG_HELP1, TRUE));
  960.         print_text (fp, s, INternal);
  961.         sprintf(s, SWITCH"hh       %s", get_longopt_description (SYM_LONG_HELP1, TRUE));
  962.         print_text (fp, s, INternal);
  963.         sprintf(s, "          %s", get_longopt_description (SYM_LONG_HELP2, TRUE));
  964.         print_text (fp, s, INternal);
  965.         strcpy(s, "          Display extended help text and quit program");
  966.         print_text (fp, s, INternal);
  967.         if (longopt_symbolic != SYM_NIL)
  968.           break;
  969.         print_text (fp, s, INternal);
  970.       case SYM_LICENSE1:
  971.       case SYM_LICENSE2:
  972.       case SYM_LICENSE3:
  973.         sprintf(s, SWITCH"L        %s", get_longopt_description (SYM_LICENSE1, TRUE));
  974.         print_text (fp, s, INternal);
  975.         sprintf(s, "          %s", get_longopt_description (SYM_LICENSE2, TRUE));
  976.         print_text (fp, s, INternal);
  977.         sprintf(s, "          %s", get_longopt_description (SYM_LICENSE3, TRUE));
  978.         print_text (fp, s, INternal);
  979.         strcpy(s, "          Display software license and quit program");
  980.         print_text (fp, s, INternal);
  981.         if (longopt_symbolic != SYM_NIL)
  982.           break;
  983.         print_text (fp, s, INternal);
  984.       case SYM_VERSION:
  985.         sprintf(s, SWITCH"V        %s", get_longopt_description (SYM_VERSION, TRUE));
  986.         print_text (fp, s, INternal);
  987.         strcpy(s, "          Display version number and quit program");
  988.         print_text (fp, s, INternal);
  989.         if (longopt_symbolic != SYM_NIL)
  990.           break;
  991.         print_text (fp, s, INternal);
  992.       case SYM_RESPONSE_FILE:
  993.         sprintf(s, SWITCH"R ARG    %s", get_longopt_description (SYM_RESPONSE_FILE, TRUE));
  994.         print_text (fp, s, INternal);
  995.         sprintf(s, "          Create response file for the `%cFILE' option", RSP_CHAR);
  996.         print_text (fp, s, INternal);
  997.         strcpy(s, "   ARG    = Store arguments of command line in file ARG");
  998.         print_text (fp, s, INternal);
  999.         if (longopt_symbolic != SYM_NIL)
  1000.           break;
  1001.         print_text (fp, s, INternal);
  1002. #  ifdef GCAL_SHELL
  1003.       case SYM_SCRIPT_FILE:
  1004.         sprintf(s, SWITCH"S ARG    %s", get_longopt_description (SYM_SCRIPT_FILE, TRUE));
  1005.         print_text (fp, s, INternal);
  1006.         sprintf(s, "          Create shell script which contains the arguments of command line");
  1007.         print_text (fp, s, INternal);
  1008.         strcpy(s, "   ARG    = File name of the shell script");
  1009.         print_text (fp, s, INternal);
  1010.         if (longopt_symbolic != SYM_NIL)
  1011.           break;
  1012.         print_text (fp, s, INternal);
  1013. #endif
  1014. #  if USE_RC
  1015.       case SYM_DATE_VARIABLE1:
  1016.       case SYM_DATE_VARIABLE2:
  1017.         sprintf(s, SWITCH"v ARG    %s", get_longopt_description (SYM_DATE_VARIABLE1, TRUE));
  1018.         print_text (fp, s, INternal);
  1019.         sprintf(s, "          %s", get_longopt_description (SYM_DATE_VARIABLE2, TRUE));
  1020.         print_text (fp, s, INternal);
  1021.         strcpy(s, "          Define global date variable(s) \"dvar->a|b|c|d|f|...|z\"");
  1022.         print_text (fp, s, INternal);
  1023.         strcpy(s, "   ARG    = Definition of `dvar"RC_DVAR_ASSIGN
  1024.                "mmdd' separated by `"SEP"' characters");
  1025.         print_text (fp, s, INternal);
  1026.         strcpy(s, "            e.g.  "SWITCH"v a"RC_DVAR_ASSIGN"1127"SEP"b"RC_DVAR_ASSIGN
  1027.                "054   Set `a' to Nov 27 and `b' to May 4");
  1028.         print_text (fp, s, INternal);
  1029.         if (longopt_symbolic != SYM_NIL)
  1030.           break;
  1031.         print_text (fp, s, INternal);
  1032. #  endif
  1033.       case SYM_DEBUG:
  1034.         sprintf(s, "          %s", get_longopt_description (SYM_DEBUG, TRUE));
  1035.         print_text (fp, s, INternal);
  1036.         strcpy(s, "          Display some debug informations");
  1037.         print_text (fp, s, INternal);
  1038.         strcpy(s, "  [ARG]   = internal    Warnings if program internal maximums are reached");
  1039.         print_text (fp, s, INternal);
  1040.         strcpy(s, "          = handled     Like `internal' and file names which are handled");
  1041.         print_text (fp, s, INternal);
  1042.         strcpy(s, "          = unhandled   Like `internal' und file names which are unhandled");
  1043.         print_text (fp, s, INternal);
  1044.         strcpy(s, "          = all         Like `handled' and `unhandled' together");
  1045.         print_text (fp, s, INternal);
  1046.         strcpy(s, "          = abort       Like `all' and abort if file name can't be handled");
  1047.         print_text (fp, s, INternal);
  1048.         if (longopt_symbolic != SYM_NIL)
  1049.           break;
  1050.         print_text (fp, s, INternal);
  1051.       case SYM_TYPE_OF_CALENDAR:
  1052.         sprintf(s, SWITCH"i[MOD]   %s", get_longopt_description (SYM_TYPE_OF_CALENDAR, TRUE));
  1053.         print_text (fp, s, INternal);
  1054.         strcpy(s, "          Use special format for calendar sheet");
  1055.         print_text (fp, s, INternal);
  1056.         strcat(s, "  [MOD]   = -   Use standard format for calendar sheet");
  1057.         print_text (fp, s, INternal);
  1058.         if (longopt_symbolic != SYM_NIL)
  1059.           break;
  1060.         print_text (fp, s, INternal);
  1061.       case SYM_SUPPRESS_CALENDAR:
  1062.         sprintf(s, SWITCH"u        %s", get_longopt_description (SYM_SUPPRESS_CALENDAR, TRUE));
  1063.         print_text (fp, s, INternal);
  1064.         strcpy(s, "          Suppress output of calendar sheet explicitly");
  1065.         print_text (fp, s, INternal);
  1066.         if (longopt_symbolic != SYM_NIL)
  1067.           break;
  1068.         print_text (fp, s, INternal);
  1069. #  if USE_PAGER
  1070.       case SYM_PAGER:
  1071.         sprintf(s, SWITCH"p        %s", get_longopt_description (SYM_PAGER, TRUE));
  1072.         print_text (fp, s, INternal);
  1073. #    ifdef GCAL_EPAGER
  1074.         if (ext_pager != (char *)NULL)
  1075.           sprintf(s, "          Pass output thru external `%s' pager",
  1076.                   (*ext_pager == *DIR_SEP) ? strrchr(ext_pager, *DIR_SEP)+1 : ext_pager);
  1077.         else
  1078.           strcpy(s, "          Pass output thru simple, internal pager");
  1079. #    else /* !GCAL_EPAGER */
  1080.         strcpy(s, "          Pass output thru simple, internal pager");
  1081. #    endif /* !GCAL_EPAGER */
  1082.         print_text (fp, s, INternal);
  1083.         if (longopt_symbolic != SYM_NIL)
  1084.           break;
  1085.         print_text (fp, s, INternal);
  1086. #  endif
  1087.       case SYM_DISABLE_HIGHLIGHTING:
  1088.         sprintf(s, SWITCH"H no     %s", get_longopt_description (SYM_DISABLE_HIGHLIGHTING, TRUE));
  1089.         print_text (fp, s, INternal);
  1090.         sprintf(s, "          %s=no",  get_longopt_description (SYM_HIGHLIGHTING, FALSE));
  1091.         print_text (fp, s, INternal);
  1092.         strcpy(s, "          Disable highlighting of text, holiday resp., actual day");
  1093.         print_text (fp, s, INternal);
  1094.         if (longopt_symbolic != SYM_NIL)
  1095.           break;
  1096.         print_text (fp, s, INternal);
  1097.       case SYM_FORCE_HIGHLIGHTING:
  1098.         sprintf(s, SWITCH"H yes    %s", get_longopt_description (SYM_FORCE_HIGHLIGHTING, TRUE));
  1099.         print_text (fp, s, INternal);
  1100.         sprintf(s, "          %s=yes",  get_longopt_description (SYM_HIGHLIGHTING, FALSE));
  1101.         print_text (fp, s, INternal);
  1102.         strcpy(s, "          Forces highlighting sequences if output is redirected/piped");
  1103.         print_text (fp, s, INternal);
  1104.         if (longopt_symbolic != SYM_NIL)
  1105.           break;
  1106.         print_text (fp, s, INternal);
  1107.       case SYM_HIGHLIGHTING:
  1108.         sprintf(s, SWITCH"H ARG    %s", get_longopt_description (SYM_HIGHLIGHTING, TRUE));
  1109.         print_text (fp, s, INternal);
  1110.         strcpy(s, "          Set highlighting sequence pairs 1 (=actual day) and 2 (=holiday)");
  1111.         print_text (fp, s, INternal);
  1112.         strcpy(s, "   ARG    = Highlighting sequence pairs separated by `"SEP"' characters");
  1113.         print_text (fp, s, INternal);
  1114.         strcpy(s, "            e.g.  "SWITCH"H \\x2"SEP"\\x"
  1115.                "AE   Use hex values 2 and AE for sequence 1");
  1116.         print_text (fp, s, INternal);
  1117.         strcpy(s, "            e.g.  "SWITCH"H "SEP""SEP"*"SEP
  1118.                "*      Use characters `*' and `*' for sequence 2");
  1119.         print_text (fp, s, INternal);
  1120.         if (longopt_symbolic != SYM_NIL)
  1121.           break;
  1122.         print_text (fp, s, INternal);
  1123.       case SYM_BLOCKS:
  1124.         sprintf(s, SWITCH"b ARG    %s", get_longopt_description (SYM_BLOCKS, TRUE));
  1125.         print_text (fp, s, INternal);
  1126.         strcpy(s, "          Modify format of year calendar");
  1127.         print_text (fp, s, INternal);
  1128.         strcpy(s, "   ARG    = 1|2|3|4|6|12   Number of blocks");
  1129.         print_text (fp, s, INternal);
  1130.         if (longopt_symbolic != SYM_NIL)
  1131.           break;
  1132.         print_text (fp, s, INternal);
  1133.       case SYM_CALENDAR_DATES:
  1134.         sprintf(s, SWITCH"j[MOD]   %s", get_longopt_description (SYM_CALENDAR_DATES, TRUE));
  1135.         print_text (fp, s, INternal);
  1136.         strcpy(s, "          Use Julian dates in calendar sheet");
  1137.         print_text (fp, s, INternal);
  1138.         strcpy(s, "  [MOD]   = b   Use both date notations (standard + Julian dates)");
  1139.         print_text (fp, s, INternal);
  1140.         if (longopt_symbolic != SYM_NIL)
  1141.           break;
  1142.         print_text (fp, s, INternal);
  1143.       case SYM_HOLIDAY_DATES:
  1144.         sprintf(s, SWITCH"jn[MOD]  %s", get_longopt_description (SYM_HOLIDAY_DATES, TRUE));
  1145.         print_text (fp, s, INternal);
  1146.         strcpy(s, "          Use Julian dates in eternal holiday list");
  1147.         print_text (fp, s, INternal);
  1148.         strcpy(s, "   [MOD]  = b   Use both date notations (standard + Julian dates)");
  1149.         print_text (fp, s, INternal);
  1150.         if (longopt_symbolic != SYM_NIL)
  1151.           break;
  1152.         print_text (fp, s, INternal);
  1153. #if USE_RC
  1154.       case SYM_FIXED_DATES:
  1155.         sprintf(s, SWITCH"jc[MOD]  %s", get_longopt_description (SYM_FIXED_DATES, TRUE));
  1156.         print_text (fp, s, INternal);
  1157.         strcpy(s, "          Use Julian dates in fixed date warning list");
  1158.         print_text (fp, s, INternal);
  1159.         strcpy(s, "   [MOD]  = b   Use both date notations (standard + Julian dates)");
  1160.         print_text (fp, s, INternal);
  1161.         if (longopt_symbolic != SYM_NIL)
  1162.           break;
  1163.         print_text (fp, s, INternal);
  1164. #endif
  1165.       case SYM_STARTING_DAY:
  1166.         sprintf(s, SWITCH"s ARG    %s", get_longopt_description (SYM_STARTING_DAY, TRUE));
  1167.         print_text (fp, s, INternal);
  1168.         strcpy(s, "          Set starting day of week");
  1169.         print_text (fp, s, INternal);
  1170.         sprintf(s, "   ARG    = 0 | %d|%s|%d|%s|...|%d|%s",
  1171.                 DAY_MIN, short3_day_name (DAY_MIN),
  1172.                 DAY_MIN+1, short3_day_name (DAY_MIN+1),
  1173.                 DAY_MAX, short3_day_name (DAY_MAX));
  1174.         print_text (fp, s, INternal);
  1175.         if (longopt_symbolic != SYM_NIL)
  1176.           break;
  1177.         print_text (fp, s, INternal);
  1178. #  ifdef GCAL_EMAIL
  1179.       case SYM_MAIL:
  1180.         sprintf(s, SWITCH"m ARG    %s", get_longopt_description (SYM_MAIL, TRUE));
  1181.         print_text (fp, s, INternal);
  1182.         strcpy(s, "          Send output via `"MAIL_PRGR"' program to user");
  1183.         print_text (fp, s, INternal);
  1184.         strcpy(s, "   ARG    = Email Address");
  1185.         print_text (fp, s, INternal);
  1186.         if (longopt_symbolic != SYM_NIL)
  1187.           break;
  1188.         print_text (fp, s, INternal);
  1189. #  endif
  1190.       case SYM_DESC_HOLIDAY_LIST:
  1191.       case SYM_HOLIDAY_LIST:
  1192.         sprintf(s, SWITCH"n|N[MOD] %s", get_longopt_description (SYM_DESC_HOLIDAY_LIST, TRUE));
  1193.         print_text (fp, s, INternal);
  1194.         sprintf(s, "          %s", get_longopt_description (SYM_HOLIDAY_LIST, TRUE));
  1195.         print_text (fp, s, INternal);
  1196.         sprintf(s, "          Display eternal holiday list "
  1197.                 "(Year in range: %d...%d)", EASTER_MIN, EASTER_MAX);
  1198.         print_text (fp, s, INternal);
  1199.         strcpy(s, " n        = Legal days and memorial days");
  1200.         print_text (fp, s, INternal);
  1201.         strcpy(s, "   N      = Legal days only");
  1202.         print_text (fp, s, INternal);
  1203.         strcpy(s, "    [MOD] = "DES_LIT"   Descending sort order");
  1204.         print_text (fp, s, INternal);
  1205.         if (longopt_symbolic != SYM_NIL)
  1206.           break;
  1207.         print_text (fp, s, INternal);
  1208.       case SYM_EXCLUDE_HD_TITLE:
  1209.         sprintf(s, SWITCH"X        %s", get_longopt_description (SYM_EXCLUDE_HD_TITLE, TRUE));
  1210.         print_text (fp, s, INternal);
  1211.         strcpy(s, "          Exclude title of eternal holiday list");
  1212.         print_text (fp, s, INternal);
  1213.       default:
  1214.         ;   /* Void */
  1215.     }
  1216. #  if USE_RC
  1217.    if (longopt_symbolic == SYM_NIL)
  1218.     {
  1219.       print_text (fp, s, INternal);
  1220.       sprintf(s, "+++ FIXED DATE WARNINGS +++");
  1221.       print_text (fp, s, INternal);
  1222.       print_text (fp, s, INternal);
  1223.     }
  1224.    switch (longopt_symbolic)
  1225.     {
  1226.       case SYM_NIL:
  1227.       case SYM_LIST_OF_FIXED_DATES:
  1228.         sprintf(s, SWITCH"c|C[MOD] %s", get_longopt_description (SYM_LIST_OF_FIXED_DATES, TRUE));
  1229.         print_text (fp, s, INternal);
  1230.         strcpy(s, "          Use standard resource file `"PRGR_RC_NAME"' for fixed dates list");
  1231.         print_text (fp, s, INternal);
  1232.         strcpy(s, "          Implies warning period:  Today");
  1233.         print_text (fp, s, INternal);
  1234.         strcpy(s, " c        = Display only those dates, for which fixed dates exists");
  1235.         print_text (fp, s, INternal);
  1236.         strcpy(s, "   C      = Display those dates, for which fixed dates doesn't exit, too");
  1237.         print_text (fp, s, INternal);
  1238.       default:
  1239.         ;   /* Void */
  1240.     }
  1241.    if (longopt_symbolic == SYM_NIL)
  1242.     {
  1243.       strcpy(s, "    [MOD] = One or more of the following modifiers which are marked by #");
  1244.       print_text (fp, s, INternal);
  1245.       print_text (fp, s, INternal);
  1246.     }
  1247.    switch (longopt_symbolic)
  1248.     {
  1249.       case SYM_NIL:
  1250.       case SYM_GROUPING_TEXT:
  1251.         sprintf(s, "          %s", get_longopt_description (SYM_GROUPING_TEXT, TRUE));
  1252.         print_text (fp, s, INternal);
  1253.         strcpy(s, "          # g[MOD]       = Group fixed date warnings by day using text MOD");
  1254.         print_text (fp, s, INternal);
  1255.         print_text (fp, s, INternal);
  1256.       default:
  1257.         ;   /* Void */
  1258.     }
  1259.    if (longopt_symbolic == SYM_NIL)
  1260.     {
  1261.       print_text (fp, s, INternal);
  1262.       strcpy(s, "          1. Sorting oder of text");
  1263.       print_text (fp, s, INternal);
  1264.     }
  1265.    switch (longopt_symbolic)
  1266.     {
  1267.       case SYM_NIL:
  1268.       case SYM_DESC_FIXED_DATES:
  1269.         sprintf(s, "          %s", get_longopt_description (SYM_DESC_FIXED_DATES, TRUE));
  1270.         print_text (fp, s, INternal);
  1271.         strcpy(s, "          # "DES_LIT"            = Descending sort order");
  1272.         print_text (fp, s, INternal);
  1273.       default:
  1274.         ;   /* Void */
  1275.     }
  1276.    if (longopt_symbolic == SYM_NIL)
  1277.     {
  1278.       print_text (fp, s, INternal);
  1279.       strcpy(s, "          2. Representation of text");
  1280.       print_text (fp, s, INternal);
  1281.     }
  1282.    switch (longopt_symbolic)
  1283.     {
  1284.       case SYM_NIL:
  1285.       case SYM_INCLUDE_FILENAME:
  1286.         sprintf(s, "          %s", get_longopt_description (SYM_INCLUDE_FILENAME, TRUE));
  1287.         print_text (fp, s, INternal);
  1288.         strcpy(s, "          # a            = Display origin of fixed date warning");
  1289.         print_text (fp, s, INternal);
  1290.         if (longopt_symbolic != SYM_NIL)
  1291.           break;
  1292.         print_text (fp, s, INternal);
  1293.       case SYM_INCLUDE_HOLIDAY:
  1294.         sprintf(s, "          %s", get_longopt_description (SYM_INCLUDE_HOLIDAY, TRUE));
  1295.         print_text (fp, s, INternal);
  1296.         strcpy(s, "          # e            = Include legal days and memorial days");
  1297.         print_text (fp, s, INternal);
  1298.         strcpy(s, "          # E            = Include legal days only");
  1299.         print_text (fp, s, INternal);
  1300.         if (longopt_symbolic != SYM_NIL)
  1301.           break;
  1302.         print_text (fp, s, INternal);
  1303.       case SYM_INCLUDE_WEEK_NO:
  1304.         sprintf(s, "          %s", get_longopt_description (SYM_INCLUDE_WEEK_NO, TRUE));
  1305.         print_text (fp, s, INternal);
  1306.         strcpy(s, "          # k            = Display ISO week number");
  1307.         print_text (fp, s, INternal);
  1308.         if (longopt_symbolic != SYM_NIL)
  1309.           break;
  1310.         print_text (fp, s, INternal);
  1311.       case SYM_OMIT_DATE_PART:
  1312.         sprintf(s, "          %s", get_longopt_description (SYM_OMIT_DATE_PART, TRUE));
  1313.         print_text (fp, s, INternal);
  1314.         strcpy(s, "          # o            = Omit repeating date part of fixed date warnings");
  1315.         print_text (fp, s, INternal);
  1316.         if (longopt_symbolic != SYM_NIL)
  1317.           break;
  1318.         print_text (fp, s, INternal);
  1319.       case SYM_EXCLUDE_RC_TITLE:
  1320.         sprintf(s, "          %s", get_longopt_description (SYM_EXCLUDE_RC_TITLE, TRUE));
  1321.         print_text (fp, s, INternal);
  1322.         strcpy(s, "          # x            = Exclude title of fixed date warning list");
  1323.         print_text (fp, s, INternal);
  1324.         if (longopt_symbolic != SYM_NIL)
  1325.           break;
  1326.         print_text (fp, s, INternal);
  1327.       case SYM_INCLUDE_CONS_NO:
  1328.         sprintf(s, "          %s", get_longopt_description (SYM_INCLUDE_CONS_NO, TRUE));
  1329.         print_text (fp, s, INternal);
  1330.         strcpy(s, "          # z            = Display consecutive number of fixed date warnings");
  1331.         print_text (fp, s, INternal);
  1332.       default:
  1333.         ;   /* Void */
  1334.     }
  1335.    if (longopt_symbolic == SYM_NIL)
  1336.     {
  1337.       print_text (fp, s, INternal);
  1338.       strcpy(s, "          3. Respected warning period");
  1339.       print_text (fp, s, INternal);
  1340.     }
  1341.    switch (longopt_symbolic)
  1342.     {
  1343.       case SYM_NIL:
  1344.       case SYM_INCLUDE_TODAY:
  1345.         sprintf(s, "          %s", get_longopt_description (SYM_INCLUDE_TODAY, TRUE));
  1346.         print_text (fp, s, INternal);
  1347.         strcpy(s, "          # d            = Include actual date if list of periods is generated");
  1348.         print_text (fp, s, INternal);
  1349.         if (longopt_symbolic != SYM_NIL)
  1350.           break;
  1351.         print_text (fp, s, INternal);
  1352.       case SYM_LIST_MODE:
  1353.         sprintf(s, "          %s", get_longopt_description (SYM_LIST_MODE, TRUE));
  1354.         print_text (fp, s, INternal);
  1355.         strcpy(s, "          # l            = Generate list of periods instead of a single period");
  1356.         print_text (fp, s, INternal);
  1357.         if (longopt_symbolic != SYM_NIL)
  1358.           break;
  1359.         print_text (fp, s, INternal);
  1360.       default:
  1361.         ;   /* Void */
  1362.     }
  1363.    switch (longopt_symbolic)
  1364.     {
  1365.       case SYM_NIL:
  1366.       case SYM_PERIOD:
  1367.         sprintf(s, "          %s", get_longopt_description (SYM_PERIOD, TRUE));
  1368.         print_text (fp, s, INternal);
  1369.         strcpy(s, "          # Nd           = Single absolute day N");
  1370.         print_text (fp, s, INternal);
  1371.         sprintf(s, "          # %cdN          = Single absolute day N",
  1372.                 RC_NWD_CHAR);
  1373.         print_text (fp, s, INternal);
  1374.         print_text (fp, s, INternal);
  1375.         strcpy(s, "          # NMOD         = Single day N relative to today");
  1376.         print_text (fp, s, INternal);
  1377.         strcpy(s, "             MOD           = "ASC_LIT"   Forwards");
  1378.         print_text (fp, s, INternal);
  1379.         strcpy(s, "                           = "DES_LIT"   Backwards");
  1380.         print_text (fp, s, INternal);
  1381.         print_text (fp, s, INternal);
  1382.         strcpy(s, "          # Nw           = Complete week N");
  1383.         print_text (fp, s, INternal);
  1384.         strcpy(s, "                           N = 0        1'st week / last week of previous year");
  1385.         print_text (fp, s, INternal);
  1386.         strcpy(s, "                           N = 1...52   1'st...52'nd week (always)");
  1387.         print_text (fp, s, INternal);
  1388.         strcpy(s, "                           N = 53       53'rd week (sometimes)");
  1389.         print_text (fp, s, INternal);
  1390.         strcpy(s, "                           N = 99       Last week");
  1391.         print_text (fp, s, INternal);
  1392.         print_text (fp, s, INternal);
  1393.         strcpy(s, "          # `mmdd'       = Single day `dd' of month `mm'");
  1394.         print_text (fp, s, INternal);
  1395.         print_text (fp, s, INternal);
  1396.         strcpy(s, "          # `mmwww'N     = Single N'th weekday `www' of month `mm'");
  1397.         print_text (fp, s, INternal);
  1398.         strcpy(s, "                           N = 1...4   1'st...4'th weekday `www' (always)");
  1399.         print_text (fp, s, INternal);
  1400.         strcpy(s, "                           N = 5       5'th weekday `www' (sometimes)");
  1401.         print_text (fp, s, INternal);
  1402.         strcpy(s, "                           N = 9       Last weekday `www'");
  1403.         print_text (fp, s, INternal);
  1404.         print_text (fp, s, INternal);
  1405.         sprintf(s, "          # %cdN`www'     = Single N'th weekday `www'",
  1406.                 RC_NWD_CHAR);
  1407.         print_text (fp, s, INternal);
  1408.         strcpy(s, "                           N = 1...51   1'st...51'st weekday `www' (always)");
  1409.         print_text (fp, s, INternal);
  1410.         strcpy(s, "                           N = 52|53    52|53'rd weekday `www' (sometimes)");
  1411.         print_text (fp, s, INternal);
  1412.         strcpy(s, "                           N = 99       Last weekday `www'");
  1413.         print_text (fp, s, INternal);
  1414.         print_text (fp, s, INternal);
  1415.         sprintf(s, "          # %cwN`www'     = Single weekday `www' of N'th week",
  1416.                 RC_NWD_CHAR);
  1417.         print_text (fp, s, INternal);
  1418.         strcpy(s, "                           N = 0        `www' which isn't located in 1'st week");
  1419.         print_text (fp, s, INternal);
  1420.         strcpy(s, "                           N = 1...51   `www' of 1'st...51'st week (always)");
  1421.         print_text (fp, s, INternal);
  1422.         strcpy(s, "                           N = 52|53    `www' of 52|53'rd week (sometimes)");
  1423.         print_text (fp, s, INternal);
  1424.         strcpy(s, "                           N = 99       `www' of last week");
  1425.         print_text (fp, s, INternal);
  1426.         print_text (fp, s, INternal);
  1427.         sprintf(s, "          # %ce[["ASC_LIT"|"DES_LIT"]N]   = "
  1428.                 "Single day N relative to Easter Sunday", RC_HDY_CHAR);
  1429.         print_text (fp, s, INternal);
  1430.         print_text (fp, s, INternal);
  1431.         sprintf(s, "          # %ce["ASC_LIT"|"DES_LIT"]N`www'= "
  1432.                 "Single N'th weekday relative to Easter Sunday", RC_HDY_CHAR);
  1433.         print_text (fp, s, INternal);
  1434.         print_text (fp, s, INternal);
  1435.         sprintf(s, "          # %cv[["ASC_LIT"|"DES_LIT"]N]   = "
  1436.                 "Single day N relative to date variable", RC_HDY_CHAR);
  1437.         print_text (fp, s, INternal);
  1438.         print_text (fp, s, INternal);
  1439.         sprintf(s, "          # %cv["ASC_LIT"|"DES_LIT"]N`www'= "
  1440.                 "Single N'th weekday relative to date variable", RC_HDY_CHAR);
  1441.         print_text (fp, s, INternal);
  1442.         print_text (fp, s, INternal);
  1443.         strcpy(s, "          # t|T          = List tomorrow");
  1444.         print_text (fp, s, INternal);
  1445.         print_text (fp, s, INternal);
  1446.         strcpy(s, "          # w|W[MOD]     = List complete week");
  1447.         print_text (fp, s, INternal);
  1448.         strcpy(s, "               [MOD]       = "ASC_LIT"   List tomorrow until ending day of week");
  1449.         print_text (fp, s, INternal);
  1450.         strcpy(s, "                           = "DES_LIT"   List yesterday until starting day of week");
  1451.         print_text (fp, s, INternal);
  1452.         print_text (fp, s, INternal);
  1453.         strcpy(s, "          # m|M[MOD]     = List complete month");
  1454.         print_text (fp, s, INternal);
  1455.         strcpy(s, "               [MOD]       = "ASC_LIT"   List tomorrow until starting day of month");
  1456.         print_text (fp, s, INternal);
  1457.         strcpy(s, "                           = "DES_LIT"   List yesterday until starting day of month");
  1458.         print_text (fp, s, INternal);
  1459.         print_text (fp, s, INternal);
  1460.         strcpy(s, "          # y|Y[MOD]     = List complete year");
  1461.         print_text (fp, s, INternal);
  1462.         strcpy(s, "               [MOD]       = "ASC_LIT"   List tomorrow until starting day of year");
  1463.         print_text (fp, s, INternal);
  1464.         strcpy(s, "                           = "DES_LIT"   List yesterday until ending day of year");
  1465.         print_text (fp, s, INternal);
  1466.         if (longopt_symbolic != SYM_NIL)
  1467.           break;
  1468.         print_text (fp, s, INternal);
  1469.       case SYM_RESOURCE_FILE:
  1470.         sprintf(s, SWITCH"f|F ARG  %s", get_longopt_description (SYM_RESOURCE_FILE, TRUE));
  1471.         print_text (fp, s, INternal);
  1472.         strcpy(s, "          Use alternative file(s) instead of standard resource file");
  1473.         print_text (fp, s, INternal);
  1474.         strcpy(s, "          Implies warning period:  Today");
  1475.         print_text (fp, s, INternal);
  1476.         strcpy(s, " f        = Display only those dates, for which fixed dates exists");
  1477.         print_text (fp, s, INternal);
  1478.         strcpy(s, "   F      = Display those dates, for which fixed dates doesn't exit, too");
  1479.         print_text (fp, s, INternal);
  1480.         strcpy(s, "     ARG  = Single file or list of files separated by `"RC_FNAME_SEP"' character");
  1481.         print_text (fp, s, INternal);
  1482.       default:
  1483.           ;   /* Void */
  1484.     }
  1485.    if (longopt_symbolic == SYM_NIL)
  1486.     {
  1487.       print_text (fp, s, INternal);
  1488.       print_text (fp, s, INternal);
  1489.       if (print_hls)
  1490.         strcpy(s, ehls2s.seq);
  1491.       sprintf(s2, "%cDATE", RC_ADATE_CHAR);
  1492.       strcat(s, s2);
  1493.       if (print_hls)
  1494.         strcat(s, ehls2e.seq);
  1495.       print_text (fp, s, INternal);
  1496.       strcpy(s, "Use given `DATE' instead of todays date");
  1497.       print_text (fp, s, INternal);
  1498.       sprintf(s, "Date format:  `"Y_LIT2"[mm[dd|www[N]]]', `"Y_LIT2"%c%c|dvar[["ASC_LIT"|"
  1499.               DES_LIT"]N[www]]', `"Y_LIT2"%cdN[www]'", RC_HDY_CHAR, RC_EASTER_CHAR, RC_NWD_CHAR);
  1500.       print_text (fp, s, INternal);
  1501.       sprintf(s, "              `"Y_LIT2"%cwN[www]', `month name[dd]', `weekday name[N]'"
  1502.               " or `dd'", RC_NWD_CHAR);
  1503.       print_text (fp, s, INternal);
  1504.     }
  1505. #  endif /* USE_RC */
  1506.    if (longopt_symbolic == SYM_NIL)
  1507.     {
  1508.       print_text (fp, s, INternal);
  1509.       print_text (fp, s, INternal);
  1510.       if (print_hls)
  1511.         strcpy(s, ehls2s.seq);
  1512.       sprintf(s2, "%cFILE", RSP_CHAR);
  1513.       strcat(s, s2);
  1514.       if (print_hls)
  1515.         strcat(s, ehls2e.seq);
  1516.       print_text (fp, s, INternal);
  1517.       strcpy(s, "Preload options and commands from `FILE'");
  1518.       print_text (fp, s, INternal);
  1519.       print_text (fp, s, INternal);
  1520.       print_text (fp, s, INternal);
  1521.       if (print_hls)
  1522.         strcpy(s, ehls2s.seq);
  1523.       strcat(s, "COMMAND");
  1524.       if (print_hls)
  1525.         strcat(s, ehls2e.seq);
  1526.       print_text (fp, s, INternal);
  1527.       sprintf(s, "mm        = Month in range:  %d...%d", MONTH_MIN, MONTH_MAX);
  1528.       print_text (fp, s, INternal);
  1529.       strcpy (s, "                        or:  month name | "MONTH3_LIT" | "
  1530.               MONTH3_LIT""MONTH3_LIT" | "MONTH3_LIT""ASC_LIT" | "MONTH3_LIT""DES_LIT);
  1531.       print_text (fp, s, INternal);
  1532.       print_text (fp, s, INternal);
  1533.       strcpy(s, "            List:   mm["YEAR_SEP""Y_LIT2"]"
  1534.              MLIST_SEP"..."MLIST_SEP"mm["YEAR_SEP""Y_LIT2"]");
  1535.       print_text (fp, s, INternal);
  1536.       strcpy(s, "            Range:  mm["YEAR_SEP""Y_LIT2"]"
  1537.              MRANGE_SEP"mm["YEAR_SEP""Y_LIT2"]");
  1538.       print_text (fp, s, INternal);
  1539.       print_text (fp, s, INternal);
  1540.       sprintf(s, Y_LIT2"      = Year  in range:  %d...%d", YEAR_MIN, YEAR_MAX);
  1541.       print_text (fp, s, INternal);
  1542.       print_text (fp, s, INternal);
  1543.       strcpy(s, "            List:   [mm"FYEAR_SEP"]"Y_LIT2
  1544.              ""YLIST_SEP"..."YLIST_SEP"[mm"FYEAR_SEP"]"Y_LIT2);
  1545.       print_text (fp, s, INternal);
  1546.       strcpy(s, "            Range:  [mm"FYEAR_SEP"]"Y_LIT2
  1547.              ""YRANGE_SEP"[mm"FYEAR_SEP"]"Y_LIT2);
  1548.       print_text (fp, s, INternal);
  1549.       print_text (fp, s, INternal);
  1550.       print_text (fp, s, INternal);
  1551.       sprintf(s, "    +++ If you specify two digits for the year"
  1552.               " I DON'T ASSUME %2d"Y_LIT" +++", act_year/100);
  1553.     }
  1554. #endif /* !USE_GER */
  1555.    if (longopt_symbolic == SYM_NIL)
  1556.     {
  1557.       print_text (fp, s, INternal);
  1558.       my_help_tail_txt (fp);
  1559.     }
  1560. }
  1561.  
  1562.  
  1563.  
  1564. #ifdef ANSI_PROTO
  1565. PUBLIC void
  1566. my_basic_help (FILE *fp)
  1567. #else /* !ANSI_PROTO */
  1568.    PUBLIC void
  1569. my_basic_help (fp)
  1570.    FILE *fp;
  1571. #endif /* !ANSI_PROTO */
  1572. /*
  1573.    Prints the basic help text to file `fp' using the central
  1574.      output function `print_text()' and uses global text buffer
  1575.      `s' internally.
  1576. */
  1577. {
  1578.    my_help_head_txt (fp);
  1579. #if USE_GER
  1580.    strcpy(s, SWITCH"h|hh   = Hilfetext; "SWITCH"L = Lizenz; "
  1581.           SWITCH"V = Version; "SWITCH"u = Kalender unterdr"UE"cken");
  1582.    print_text (fp, s, INternal);
  1583.    strcpy(s, SWITCH"i[-]   = Spezial-Kalenderformat; ");
  1584. #  if USE_PAGER
  1585.    strcat(s, SWITCH"p = Paginierer; ");
  1586. #  endif
  1587.    strcat(s, SWITCH"H yes = Mit Hervorhebungen");
  1588.    print_text (fp, s, INternal);
  1589.    strcpy(s, SWITCH"b ARG  = Jahreskalender in "
  1590.           "1|2|3|4|6|12 Bl"OE"cken; "SWITCH"H no = Ohne Hervorhebungen");
  1591.    print_text (fp, s, INternal);
  1592.    strcpy(s, SWITCH"j[]    = Ausgabe als Julianisches Datum (Modifizierer: ");
  1593. #  if USE_RC
  1594.    strcat(s, "[b n nb c cb])");
  1595. #  else /* !USE_RC */
  1596.    strcat(s, "[b n nb])");
  1597. #  endif /* !USE_RC */
  1598.    print_text (fp, s, INternal);
  1599.    sprintf(s, SWITCH"s ARG  = Starttag der Woche "
  1600.            "(Bereich: 0 | %d|%s|%d|%s|...|%d|%s)",
  1601.            DAY_MIN, short_day_name (DAY_MIN),
  1602.            DAY_MIN+1, short_day_name (DAY_MIN+1),
  1603.            DAY_MAX, short_day_name (DAY_MAX));
  1604.    print_text (fp, s, INternal);
  1605.    sprintf(s, SWITCH"n|N["DES_LIT"] = Ewige Feiertagsliste ausgeben "
  1606.            "(Jahr im Bereich: %d...%d)", EASTER_MIN, EASTER_MAX);
  1607.    print_text (fp, s, INternal);
  1608. #  if USE_RC
  1609.    strcpy(s, SWITCH"c|C[]  = Terminliste aus Datei `"PRGR_RC_NAME"'; "
  1610.           SWITCH"f|F ARG["RC_FNAME_SEP"ARG+...]=Benutze Datei ARG");
  1611.    print_text (fp, s, INternal);
  1612.    strcpy(s, "    ^^--> [g[] | ["DES_LIT"adeEkloxz][N[d|w|"ASC_LIT
  1613.           "|"DES_LIT"]|`mmtt'|`mmwww'N|t|[w|m|y["ASC_LIT"|"DES_LIT"]]]]");
  1614.    print_text (fp, s, INternal);
  1615. #  endif
  1616.    sprintf(s, "mm   = Monat im Bereich: %d...%d               "
  1617.            "Liste:   mm["YEAR_SEP""Y_LIT2"]"MLIST_SEP"..."MLIST_SEP
  1618.            "mm["YEAR_SEP""Y_LIT2"]", MONTH_MIN, MONTH_MAX);
  1619.    print_text (fp, s, INternal);
  1620.    strcpy(s, "                   oder: Monatsname|"MONTH3_LIT"["MONTH3_LIT"|"ASC_LIT"|"DES_LIT"]  "
  1621.           "Bereich: mm["YEAR_SEP""Y_LIT2"]"MRANGE_SEP"mm["YEAR_SEP""Y_LIT2"]");
  1622.    print_text (fp, s, INternal);
  1623.    sprintf(s, Y_LIT2" = Jahr  im Bereich: %d...%d%*s       "
  1624.            "Liste:   [mm"FYEAR_SEP"]"Y_LIT2""YLIST_SEP"..."YLIST_SEP
  1625.            "[mm"FYEAR_SEP"]"Y_LIT2, YEAR_MIN, YEAR_MAX, 6-len_year_max+4, "");
  1626.    print_text (fp, s, INternal);
  1627.    strcpy(s, "                                              "
  1628.           "Bereich: [mm"FYEAR_SEP"]"Y_LIT2""YRANGE_SEP"[mm"FYEAR_SEP"]"Y_LIT2);
  1629.    print_text (fp, s, INternal);
  1630.    sprintf(s, "   +++ Bei zweistelliger Jahresangabe wird NICHT"
  1631.            " von %2d"Y_LIT" ausgegangen +++", act_year/100);
  1632. #else /* !USE_GER */
  1633.    strcpy(s, SWITCH"h|hh   = Help screen; "SWITCH"L = License; "
  1634.           SWITCH"V = Version; "SWITCH"u = Suppress calendar sheet");
  1635.    print_text (fp, s, INternal);
  1636.    strcpy(s, SWITCH"i[-]   = Special calendar format; ");
  1637. #  if USE_PAGER
  1638.    strcat(s, SWITCH"p = Simple pager; ");
  1639. #  endif
  1640.    strcat(s, SWITCH"H yes = Use highlighting");
  1641.    print_text (fp, s, INternal);
  1642.    strcpy(s, SWITCH"b ARG  = Year calendar with 1|2|3|4|6|12 blocks; "
  1643.           SWITCH"H no = Disable highlighting");
  1644.    print_text (fp, s, INternal);
  1645.    strcpy(s, SWITCH"j[]    = Output of Julian dates (Modifiers: ");
  1646. #  if USE_RC
  1647.    strcat(s, "[b n nb c cb])");
  1648. #  else /* !USE_RC */
  1649.    strcat(s, "[b n nb])");
  1650. #  endif /* !USE_RC */
  1651.    print_text (fp, s, INternal);
  1652.    sprintf(s, SWITCH"s ARG  = Starting day of week "
  1653.            "(Range: 0 | %d|%s|%d|%s|...|%d|%s)",
  1654.            DAY_MIN, short3_day_name (DAY_MIN),
  1655.            DAY_MIN+1, short3_day_name (DAY_MIN+1),
  1656.            DAY_MAX, short3_day_name (DAY_MAX));
  1657.    print_text (fp, s, INternal);
  1658.    sprintf(s, SWITCH"n|N["DES_LIT"] = Display eternal holiday list "
  1659.            "(Year in range: %d...%d)", EASTER_MIN, EASTER_MAX);
  1660.    print_text (fp, s, INternal);
  1661. #  if USE_RC
  1662.    strcpy(s, SWITCH"c|C[]  = Fixed dates list of file `"PRGR_RC_NAME"'; "
  1663.           SWITCH"f|F ARG["RC_FNAME_SEP"ARG+...]=Use file ARG");
  1664.    print_text (fp, s, INternal);
  1665.    strcpy(s, "    ^^--> [g[] | ["DES_LIT"adeEkloxz][N[d|w|"ASC_LIT
  1666.           "|"DES_LIT"]|`mmdd'|`mmwww'N|t|[w|m|y["ASC_LIT"|"DES_LIT"]]]]");
  1667.    print_text (fp, s, INternal);
  1668. #  endif
  1669.    sprintf(s, "mm    = Month in range: %d...%d                 "
  1670.            "List:  mm["YEAR_SEP""Y_LIT2"]"MLIST_SEP"..."MLIST_SEP
  1671.            "mm["YEAR_SEP""Y_LIT2"]", MONTH_MIN, MONTH_MAX);
  1672.    print_text (fp, s, INternal);
  1673.    strcpy(s, "                    or: month name|"MONTH3_LIT"["MONTH3_LIT"|"ASC_LIT"|"DES_LIT"]    "
  1674.           "Range: mm["YEAR_SEP""Y_LIT2"]"MRANGE_SEP"mm["YEAR_SEP""Y_LIT2"]");
  1675.    print_text (fp, s, INternal);
  1676.    sprintf(s, Y_LIT2"  = Year  in range: %d...%d%*s         "
  1677.            "List:  [mm"FYEAR_SEP"]"Y_LIT2""YLIST_SEP"..."YLIST_SEP
  1678.            "[mm"FYEAR_SEP"]"Y_LIT2, YEAR_MIN, YEAR_MAX, 6-len_year_max+4, "");
  1679.    print_text (fp, s, INternal);
  1680.    strcpy(s, "                                               "
  1681.           "Range: [mm"FYEAR_SEP"]"Y_LIT2""YRANGE_SEP"[mm"FYEAR_SEP"]"Y_LIT2);
  1682.    print_text (fp, s, INternal);
  1683.    sprintf(s, "    +++ If you specify two digits for the year"
  1684.            " I DON'T assume %2d"Y_LIT" +++", act_year/100);
  1685. #endif /* !USE_GER */
  1686.    my_help_tail_txt (fp);
  1687. }
  1688.  
  1689.  
  1690.  
  1691. #ifdef ANSI_PROTO
  1692. PUBLIC void
  1693. my_license (      FILE *fp,
  1694.             const char *prgr_id)
  1695. #else /* !ANSI_PROTO */
  1696.    PUBLIC void
  1697. my_license (fp, prgr_id)
  1698.          FILE *fp;
  1699.    const char *prgr_id;
  1700. #endif /* !ANSI_PROTO */
  1701. /*
  1702.    Prints program-id and the license text to file `fp' using the central
  1703.      output function `print_text()', uses global text buffer `s' internally.
  1704. */
  1705. {
  1706.    my_copyright (fp, prgr_id);
  1707. #if USE_GER
  1708.    strcpy(s, "   Diese Software erhebt keinen Anspruch auf Vollst"AE"ndigkeit,");
  1709.    print_text (fp, s, INternal);
  1710.    strcpy(s, "   Verwendungsf"AE"higkeit oder Korrektheit. F"UE"r jedwede Sch"AE"den oder");
  1711.    print_text (fp, s, INternal);
  1712.    strcpy(s, "   Verluste (implizit oder explizit), die aus Nutzung oder Handhabung");
  1713.    print_text (fp, s, INternal);
  1714.    strcpy(s, "   meiner Software hervorgehen, wird grunds"AE"tzlich keine Haftung");
  1715.    print_text (fp, s, INternal);
  1716.    strcpy(s, "   "UE"bernommen. Bei Verwendung dieser Software erkl"AE"rt sich der Benutzer");
  1717.    print_text (fp, s, INternal);
  1718.    strcpy(s, "   mit dieser Vereinbarung in vollem Umfang einverstanden.");
  1719.    print_text (fp, s, INternal);
  1720.    print_text (fp, s, INternal);
  1721.    strcpy(s, "   Dieses Programm ist freie Software; Sie k"OE"nnen es weitervertreiben");
  1722.    print_text (fp, s, INternal);
  1723.    strcpy(s, "   und/oder ver"AE"ndern innerhalb der Bestimmungen der `GNU General Public");
  1724.    print_text (fp, s, INternal);
  1725.    strcpy(s, "   License'; herausgegeben von der `Free Software Foundation';");
  1726.    print_text (fp, s, INternal);
  1727.    strcpy(s, "   in der Version 2 oder jeder sp"AE"teren Version.");
  1728.    print_text (fp, s, INternal);
  1729.    print_text (fp, s, INternal);
  1730.    strcpy(s, "   Sie sollten eine Kopie der `GNU General Public License' zusammen mit");
  1731.    print_text (fp, s, INternal);
  1732.    strcpy(s, "   diesem Programm erhalten haben; falls nicht, schreiben Sie an die:");
  1733. #else /* !USE_GER */
  1734.    strcpy(s, "   This software doesn't claim completeness, correctness or usability.");
  1735.    print_text (fp, s, INternal);
  1736.    strcpy(s, "   On principle I will not be liable for any damages or losses (implicit");
  1737.    print_text (fp, s, INternal);
  1738.    strcpy(s, "   or explicit), which result from using or handling my software.");
  1739.    print_text (fp, s, INternal);
  1740.    strcpy(s, "   If you use this software, you agree without any exception to this");
  1741.    print_text (fp, s, INternal);
  1742.    strcpy(s, "   agreement, which binds you LEGALLY !!");
  1743.    print_text (fp, s, INternal);
  1744.    print_text (fp, s, INternal);
  1745.    strcpy(s, "   This program is free software; you can redistribute it and/or modify");
  1746.    print_text (fp, s, INternal);
  1747.    strcpy(s, "   it under the terms of the `GNU General Public License' as published by");
  1748.    print_text (fp, s, INternal);
  1749.    strcpy(s, "   the `Free Software Foundation'; either version 2, or (at your option)");
  1750.    print_text (fp, s, INternal);
  1751.    strcpy(s, "   any later version.");
  1752.    print_text (fp, s, INternal);
  1753.    print_text (fp, s, INternal);
  1754.    strcpy(s, "   You should have received a copy of the `GNU General Public License'");
  1755.    print_text (fp, s, INternal);
  1756.    strcpy(s, "   along with this program; if not, write to the:");
  1757. #endif /* !USE_GER */
  1758.    print_text (fp, s, INternal);
  1759.    print_text (fp, s, INternal);
  1760.    strcpy(s, "      Free Software Foundation");
  1761.    print_text (fp, s, INternal);
  1762.    strcpy(s, "      59 Temple Place, Suite 330");
  1763.    print_text (fp, s, INternal);
  1764.    strcpy(s, "      Boston, MA 02111-1307  USA");
  1765.    print_text (fp, s, INternal);
  1766. }
  1767.  
  1768.  
  1769.  
  1770. #ifdef ANSI_PROTO
  1771. PUBLIC void
  1772. my_version (      FILE *fp,
  1773.             const char *prgr_id)
  1774. #else /* !ANSI_PROTO */
  1775.    PUBLIC void
  1776. my_version (fp, prgr_id)
  1777.          FILE *fp;
  1778.    const char *prgr_id;
  1779. #endif /* !ANSI_PROTO */
  1780. /*
  1781.    Prints program-id and all compilation flags to file `fp' using the central
  1782.      output function `print_text()', uses global text buffer `s' internally.
  1783. */
  1784. {
  1785.    register int  i=0;
  1786.  
  1787.  
  1788.    my_copyright (fp, prgr_id);
  1789. #if USE_GER
  1790.    strcpy(s, "   Kompilations-Optionen:");
  1791. #else /* !USE_GER */
  1792.    strcpy(s, "   Compilation options:");
  1793. #endif /* !USE_GER */
  1794.    print_text (fp, s, INternal);
  1795. #if HAVE_ASSERT_H && DEBUG
  1796.    strcpy(s, "      DEBUG");
  1797.    print_text (fp, s, INternal);
  1798. #endif
  1799.    strcpy(s, "     ");
  1800. #if USE_CATH
  1801.    strcat(s, " USE_CATH");
  1802.    i++;
  1803. #endif
  1804. #if USE_EASC
  1805.    strcat(s, " USE_EASC");
  1806.    i++;
  1807. #endif
  1808. #if USE_GER
  1809.    strcat(s, " USE_GER");
  1810.    i++;
  1811. #endif
  1812. #if USE_HLS
  1813.    strcat(s, " USE_HLS");
  1814.    i++;
  1815. #endif
  1816. #if USE_PAGER
  1817.    strcat(s, " USE_PAGER");
  1818.    i++;
  1819. #endif
  1820. #if USE_RC
  1821.    strcat(s, " USE_RC");
  1822.    i++;
  1823. #endif
  1824. #if !USE_GER && USE_USHDY
  1825.    strcat(s, " USE_USHDY");
  1826.    i++;
  1827. #endif
  1828.    if (i)
  1829.      print_text (fp, s, INternal);
  1830.    sprintf(s, "      EXIT_STAT_HELP=%d", EXIT_STAT_HLP);
  1831.    print_text (fp, s, INternal);
  1832.    sprintf(s, "      GREG_%d (%d-%d %s)", GREG_YEAR,
  1833.            GREG_F_DAY, GREG_L_DAY, short_month_name (GREG_MONTH));
  1834.    print_text (fp, s, INternal);
  1835.    sprintf(s, "      GCAL_SYS_LIBDIR=%s", GCAL_SYS_LIBDIR);
  1836.    print_text (fp, s, INternal);
  1837.    sprintf(s, "      GCAL_USR_LIBDIR=%s", GCAL_USR_LIBDIR);
  1838.    print_text (fp, s, INternal);
  1839. }
  1840.  
  1841.  
  1842.  
  1843. #ifdef ANSI_PROTO
  1844. PUBLIC VOID_PTR
  1845. my_malloc (const int   amount,
  1846.            const int   exit_status,
  1847.            const char *module_name,
  1848.            const int   module_line,
  1849.            const char *var_name,
  1850.            const int   var_contents)
  1851. #else /* !ANSI_PROTO */
  1852.    PUBLIC VOID_PTR
  1853. my_malloc (amount, exit_status, module_name, module_line, var_name, var_contents)
  1854.    const int   amount;
  1855.    const int   exit_status;
  1856.    const char *module_name;
  1857.    const int   module_line;
  1858.    const char *var_name;
  1859.    const int   var_contents;
  1860. #endif /* !ANSI_PROTO */
  1861. /*
  1862.    Allocate AMOUNT bytes of memory dynamically, with error checking.
  1863.      calls `my_error()' and terminates program if any errors occur.
  1864.      AMOUNT is limited to `int' instead of `size_t'...
  1865. */
  1866. {
  1867.    auto VOID_PTR  ptr_memblock=(VOID_PTR)malloc((int)amount);
  1868.  
  1869.  
  1870.    if (ptr_memblock == (VOID_PTR)NULL)
  1871.      /*
  1872.         Error, `malloc()' have failed
  1873.      */
  1874.      my_error (exit_status, module_name, module_line, var_name, var_contents);
  1875.  
  1876.    return(ptr_memblock);
  1877. }
  1878.  
  1879.  
  1880.  
  1881. #ifdef ANSI_PROTO
  1882. PUBLIC VOID_PTR
  1883. my_realloc (      VOID_PTR  ptr_memblock,
  1884.             const int       amount,
  1885.             const int       exit_status,
  1886.             const char     *module_name,
  1887.             const int       module_line,
  1888.             const char     *var_name,
  1889.             const int       var_contents)
  1890. #else /* !ANSI_PROTO */
  1891.    PUBLIC VOID_PTR
  1892. my_realloc (ptr_memblock, amount, exit_status, module_name, module_line, var_name, var_contents)
  1893.          VOID_PTR  ptr_memblock;
  1894.    const int       amount;
  1895.    const int       exit_status;
  1896.    const char     *module_name;
  1897.    const int       module_line;
  1898.    const char     *var_name;
  1899.    const int       var_contents;
  1900. #endif /* !ANSI_PROTO */
  1901. /*
  1902.    Change the size of an allocated block of memory PTR_MEMBLOCK to AMOUNT
  1903.      bytes, with error checking.  calls `my_error()' and terminates program
  1904.      if any errors occur.  AMOUNT is limited to `int' instead of `size_t'...
  1905.      If PTR_MEMBLOCK is NULL, run my_malloc().
  1906. */
  1907. {
  1908.    if (ptr_memblock == (VOID_PTR)NULL)
  1909.      return(my_malloc (amount, exit_status, module_name, module_line, var_name, var_contents));
  1910.    ptr_memblock = (VOID_PTR)realloc(ptr_memblock, (int)amount);
  1911.    if (ptr_memblock == (VOID_PTR)NULL)
  1912.      /*
  1913.         Error, `realloc()' have failed
  1914.      */
  1915.      my_error (exit_status, module_name, module_line, var_name, var_contents);
  1916.  
  1917.    return(ptr_memblock);
  1918. }
  1919.  
  1920.  
  1921.  
  1922. #ifdef ANSI_PROTO
  1923. PUBLIC void
  1924. my_error (const int   exit_status,
  1925.           const char *module_name,
  1926.           const int   module_line,
  1927.           const char *var_name,
  1928.           const int   var_contents)
  1929. #else /* !ANSI_PROTO */
  1930.    PUBLIC void
  1931. my_error (exit_status, module_name, module_line, var_name, var_contents)
  1932.    const int   exit_status;
  1933.    const char *module_name;
  1934.    const int   module_line;
  1935.    const char *var_name;
  1936.    const int   var_contents;
  1937. #endif /* !ANSI_PROTO */
  1938. /*
  1939.    Displays a specific error message on stderr channel
  1940.      and terminates the program with status `exit_status'
  1941. */
  1942. {
  1943. #if USE_GER
  1944.    fprintf(stderr, "\n%s: Abbruch, ", prgr_name);
  1945. #else /* !USE_GER */
  1946.    fprintf(stderr, "\n%s: Abort, ", prgr_name);
  1947. #endif /* !USE_GER */
  1948.    switch(exit_status)
  1949.     {
  1950. #if USE_GER
  1951.       case 125:
  1952.         fprintf(stderr, "unzul"AE"ssiges Jahr f"UE"r Ostertagsberechnung\n"
  1953.                 "Jahr mu"SZ" im Bereich (%d...%d) sein", EASTER_MIN, EASTER_MAX);
  1954.         break;
  1955.       case 124:
  1956.         fprintf(stderr, "`%s' Zeile %d: Virtueller Speicher ersch"OE"pft (%s=%d)",
  1957.                 module_name, module_line, var_name, var_contents);
  1958.         break;
  1959. #  if USE_RC
  1960. #    define  TMP_TXT  " in Resourcen-Datei `%s'\n"
  1961.       case 123:
  1962.         fprintf(stderr, "unzul"AE"ssiger Datumeintrag"TMP_TXT
  1963.                 "Zeile %d: %s", module_name, module_line, var_name);
  1964.         break;
  1965.       case 122:
  1966.         fprintf(stderr, "ung"UE"ltiger Monat(%02d)"TMP_TXT
  1967.                 "Zeile %d: %s", var_contents, module_name, module_line, var_name);
  1968.         break;
  1969.       case 121:
  1970.         fprintf(stderr, "ung"UE"ltiger Tag(%02d)"TMP_TXT
  1971.                 "Zeile %d: %s", var_contents, module_name, module_line, var_name);
  1972.         break;
  1973.       case 120:
  1974.         fprintf(stderr, "mi"SZ"gebildetes "RC_INCL_STMENT""TMP_TXT
  1975.                 "Zeile %d: %s", module_name, module_line, var_name);
  1976.         break;
  1977.       case 119:
  1978.         fprintf(stderr, "unzul"AE"ssiges Sub-"RC_INCL_STMENT""TMP_TXT
  1979.                 "Zeile %d: %s", module_name, module_line, var_name);
  1980.         break;
  1981.       case 118:
  1982.         fprintf(stderr, "Datei `%s' nicht gefunden", module_name);
  1983.         break;
  1984.       case 117:
  1985.         fprintf(stderr, "ung"UE"ltiges n'ter Wochentagfeld(%01d)"TMP_TXT
  1986.                 "Zeile %d: %s", var_contents, module_name, module_line, var_name);
  1987.         break;
  1988.       case 116:
  1989.         fprintf(stderr, "fehlendes Leerzeichen nach Datumteil"TMP_TXT
  1990.                 "Zeile %d: %s", module_name, module_line, var_name);
  1991.         break;
  1992.       case 115:
  1993.         fprintf(stderr, "kann Antwortdatei `%s' nicht schreiben", module_name);
  1994.         break;
  1995.       case 114:
  1996.         if (*module_name)
  1997.           fprintf(stderr, "illegale Datumvariablen-Operation"TMP_TXT
  1998.                   "Zeile %d: %s", module_name, module_line, var_name);
  1999.         else
  2000.          {
  2001.            fprintf(stderr, "illegale Datumvariablen-Operation (%s)\n", var_name);
  2002.            fputs(usage_msg (), stderr);
  2003.            S_NEWLINE(stderr);
  2004.            put_longopt_description (stderr);
  2005.          }
  2006.         break;
  2007. #  endif /* USE_RC */
  2008. #  ifdef GCAL_EMAIL
  2009.       case 111:
  2010.         fprintf(stderr, "versenden der Email an `%s' hat versagt", var_name);
  2011.         break;
  2012. #  endif
  2013. #  ifdef GCAL_EPAGER
  2014.       case 110:
  2015.         fprintf(stderr, "`%s' Zeile %d: %s hat versagt",
  2016.                 module_name, module_line, var_name);
  2017.         break;
  2018. #  endif
  2019.       case 109:
  2020.         fprintf(stderr, "Lesefehler in Datei `%s' ", module_name);
  2021.       default:
  2022.         fprintf(stderr, "unbehandelter interner Fehler (%d)", exit_status);
  2023. #else /* !USE_GER */
  2024.       case 125:
  2025.         fprintf(stderr, "invalid year for computing Easter Sunday\n"
  2026.                 "Year must be in range (%d...%d)", EASTER_MIN, EASTER_MAX);
  2027.         break;
  2028.       case 124:
  2029.         fprintf(stderr, "`%s' line %d: virtual memory exhausted (%s=%d)",
  2030.                 module_name, module_line, var_name, var_contents);
  2031.         break;
  2032. #  if USE_RC
  2033. #    define  TMP_TXT  " in resource file `%s'\n"
  2034.       case 123:
  2035.         fprintf(stderr, "invalid date part"TMP_TXT
  2036.                 "Line %d: %s", module_name, module_line, var_name);
  2037.         break;
  2038.       case 122:
  2039.         fprintf(stderr, "invalid month field(%02d)"TMP_TXT
  2040.                 "Line %d: %s", var_contents, module_name, module_line, var_name);
  2041.         break;
  2042.       case 121:
  2043.         fprintf(stderr, "invalid day field(%02d)"TMP_TXT
  2044.                 "Line %d: %s", var_contents, module_name, module_line, var_name);
  2045.         break;
  2046.       case 120:
  2047.         fprintf(stderr, "malformed "RC_INCL_STMENT""TMP_TXT
  2048.                 "Line %d: %s", module_name, module_line, var_name);
  2049.         break;
  2050.       case 119:
  2051.         fprintf(stderr, "invalid sub-"RC_INCL_STMENT""TMP_TXT
  2052.                 "Line %d: %s", module_name, module_line, var_name);
  2053.         break;
  2054.       case 118:
  2055.         fprintf(stderr, "file `%s' not found", module_name);
  2056.         break;
  2057.       case 117:
  2058.         fprintf(stderr, "invalid n'th weekday field(%01d)"TMP_TXT
  2059.                 "Line %d: %s", var_contents, module_name, module_line, var_name);
  2060.         break;
  2061.       case 116:
  2062.         fprintf(stderr, "missing whitespace after date part"TMP_TXT
  2063.                 "Line %d: %s", module_name, module_line, var_name);
  2064.         break;
  2065.       case 115:
  2066.         fprintf(stderr, "response file `%s' can't be written", module_name);
  2067.         break;
  2068.       case 114:
  2069.         if (*module_name)
  2070.           fprintf(stderr, "illegal date variable operation"TMP_TXT
  2071.                   "Line %d: %s", module_name, module_line, var_name);
  2072.         else
  2073.          {
  2074.            fprintf(stderr, "illegal date variable operation (%s)\n", var_name);
  2075.            fputs(usage_msg (), stderr);
  2076.            S_NEWLINE(stderr);
  2077.            put_longopt_description (stderr);
  2078.          }
  2079.         break;
  2080. #  endif /* USE_RC */
  2081. #  ifdef GCAL_EMAIL
  2082.       case 111:
  2083.         fprintf(stderr, "sending Email to `%s' fails", var_name);
  2084.         break;
  2085. #  endif
  2086. #  ifdef GCAL_EPAGER
  2087.       case 110:
  2088.         fprintf(stderr, "`%s' line %d: %s fails",
  2089.                 module_name, module_line, var_name);
  2090.         break;
  2091. #  endif
  2092.       case 109:
  2093.         fprintf(stderr, "read error in file `%s' ", module_name);
  2094.       default:
  2095.         fprintf(stderr, "unmanaged internal error (%d)", exit_status);
  2096. #endif /* !USE_GER */
  2097.     }
  2098.    S_NEWLINE(stderr);
  2099.    exit(exit_status);
  2100. }
  2101.  
  2102.  
  2103.  
  2104. #ifdef ANSI_PROTO
  2105. PUBLIC int
  2106. my_atoi (const char *s)
  2107. #else /* !ANSI_PROTO */
  2108.    PUBLIC int
  2109. my_atoi (s)
  2110.    const char *s;
  2111. #endif /* !ANSI_PROTO */
  2112. /*
  2113.    Converts given string `s' to a positiv integer value
  2114.      skipping leading zeros and returns values in
  2115.      range 0...YEAR_MAX only (invalid values are set to 0)
  2116. */
  2117. {
  2118.    while (*s == '0')
  2119.      s++;
  2120.    if (   *s == '-'
  2121.        || (int)strlen(s) > len_year_max)
  2122.      return(0);
  2123.  
  2124.    return(atoi(s));
  2125. }
  2126.  
  2127.  
  2128.  
  2129. #ifdef ANSI_PROTO
  2130. PUBLIC Bool
  2131. get_actual_date (void)
  2132. #else /* !ANSI_PROTO */
  2133.    PUBLIC Bool
  2134. get_actual_date ()
  2135. #endif /* !ANSI_PROTO */
  2136. /*
  2137.    Gets the actual date from the system resp.,
  2138.      evaluates the "actual" date from global `rc_adate'-ptr to string
  2139. */
  2140. {
  2141.    auto   struct tm         *sys_date;
  2142.    auto          MY_TIME_T   sys_time;
  2143.    static Bool               got_time=FALSE;
  2144.  
  2145.  
  2146.    sys_time  = time((MY_TIME_T *)NULL);
  2147.    sys_date  = localtime(&sys_time);
  2148.    if (!got_time)
  2149.     {
  2150.       got_time = TRUE;
  2151.       act_sec  = sys_date->tm_sec;
  2152.       act_min  = sys_date->tm_min;
  2153.       act_hour = sys_date->tm_hour;
  2154.     }
  2155.    buf_ad=act_day   = sys_date->tm_mday;
  2156.    buf_am=act_month = sys_date->tm_mon + 1;
  2157.    act_year  = sys_date->tm_year;
  2158.    if (act_year < CENTURY)
  2159.      act_year += CENTURY;
  2160.    buf_ay = act_year;
  2161. #if USE_RC
  2162.    if (rc_adate != (char *)NULL)
  2163.     {
  2164.       auto int    d=0;
  2165.       auto int    m=0;
  2166.       auto int    y=0;
  2167.       auto int    n=0;
  2168.       auto int    hn=0;
  2169.       auto int    hwd=0;
  2170.       auto int    i_dummy;
  2171.       auto char   hc='\0';
  2172.       auto char  *c_dummy=(char *)NULL;
  2173.       auto Bool   b_dummy;
  2174.  
  2175.  
  2176.       if (   !*rc_adate
  2177.           || *rc_adate == RC_HDY_CHAR)
  2178.         return(FALSE);
  2179.       /*
  2180.          Pre-initialize month and year to actual date
  2181.       */
  2182.       m = act_month;
  2183.       y = act_year;
  2184.       /*
  2185.          Check if numeric date is given
  2186.       */
  2187.       if (isdigit(*rc_adate))
  2188.        {
  2189.          /*
  2190.             Check if numeric day in month is given
  2191.          */
  2192.          if ((int)strlen(rc_adate) <= 2)
  2193.           {
  2194.             d = atoi(rc_adate);
  2195.             if (!d)
  2196.               /*
  2197.                  Error, invalid day number given
  2198.               */
  2199.               return(FALSE);
  2200.           }
  2201.          else
  2202.            (void)rc_get_date (rc_adate, &b_dummy, &d, &m, &y, &n, &i_dummy,
  2203.                               &hc, &hn, &hwd, c_dummy, i_dummy, c_dummy, FALSE);
  2204.        }
  2205.       else
  2206.        {
  2207.          /*
  2208.             Check if textual weekday name is given
  2209.          */
  2210.          d = compare_d_m_name (rc_adate, DAy);
  2211.          if (d)
  2212.           {
  2213.             /*
  2214.                If a digit (1...5, 9) trails the textual weekday name,
  2215.                  generate "n'th weekday of month" date
  2216.             */
  2217.             c_dummy = rc_adate;
  2218.             while (   isupper(*c_dummy)
  2219.                    || islower(*c_dummy))
  2220.               c_dummy++;
  2221.             if (*c_dummy)
  2222.              {
  2223.                n = atoi(c_dummy);
  2224.                if (!n)
  2225.                  /*
  2226.                     Invalid "n'th weekday of month" given (must be 1...5, 9)
  2227.                  */
  2228.                  return(FALSE);
  2229.              }
  2230.             else
  2231.              {
  2232.                /*
  2233.                   Only textual weekday name found, so compute absolute day
  2234.                     in month of that weekday (of current week)
  2235.                */
  2236.                hn = act_day;
  2237.                i_dummy = weekday_of_date (act_day, act_month, act_year);
  2238.                if (d > i_dummy)
  2239.                  do
  2240.                   {
  2241.                     next_date (&hn, &m, &y);
  2242.                   } while (d != weekday_of_date (hn, m, y));
  2243.                else
  2244.                  if (d < i_dummy)
  2245.                    do
  2246.                     {
  2247.                       prev_date (&hn, &m, &y);
  2248.                     } while (d != weekday_of_date (hn, m, y));
  2249.                d = hn;
  2250.              }
  2251.           }
  2252.          else
  2253.           {
  2254.             /*
  2255.                Check if short month name is given
  2256.             */
  2257.             m = compare_d_m_name (rc_adate, MOnth);
  2258.             if (!m)
  2259.               /*
  2260.                  Error, invalid month name given
  2261.               */
  2262.               return(FALSE);
  2263.             /*
  2264.                Check if day number trails textual month name
  2265.             */
  2266.             c_dummy = rc_adate;
  2267.             while (   isupper(*c_dummy)
  2268. #  if USE_EASC
  2269.                    || *c_dummy == *AE
  2270.                    || *c_dummy == *OE
  2271.                    || *c_dummy == *UE
  2272.                    || *c_dummy == *AAE
  2273.                    || *c_dummy == *OOE
  2274.                    || *c_dummy == *UUE
  2275. #  else /* !USE_EASC */
  2276.                    || *c_dummy == '"'
  2277. #  endif /* !USE_EASC */
  2278.                    || islower(*c_dummy))
  2279.               c_dummy++;
  2280.             if (*c_dummy)
  2281.              {
  2282.                d = atoi(c_dummy);
  2283.                if (!d)
  2284.                  /*
  2285.                     Error, invalid trailing day number given
  2286.                  */
  2287.                  return(FALSE);
  2288.              }
  2289.             else
  2290.               d = act_day;
  2291.           }
  2292.        }
  2293.       if (y >= 0)
  2294.        {
  2295.          if (!y)
  2296.            y = act_year;
  2297.          if (!m)
  2298.            m = act_month;
  2299.          if (n)
  2300.           {
  2301.             if (d > DAY_MAX)
  2302.               return(FALSE);
  2303.             if (!d)
  2304.               d = weekday_of_date (act_day, m, y);
  2305.             if (m == 2)
  2306.               i_dummy = days_of_february (y);
  2307.             else
  2308.               i_dummy = dvec[m-1];
  2309.             if (n == 9)
  2310.               d = eval_holiday (i_dummy, m, y, d, FALSE);
  2311.             else
  2312.               if (   (n >= 1)
  2313.                   && (n <= 5))
  2314.                {
  2315.                  d = eval_holiday (DAY_MIN, m, y, d, TRUE);
  2316.                  d += (DAY_MAX * (n - 1));
  2317.                  /*
  2318.                     The "n'th weekday of month" doesn't occur in month:
  2319.                       generate no "actual" date
  2320.                  */
  2321.                  if (d > i_dummy)
  2322.                    return(FALSE);
  2323.                }
  2324.               else
  2325.                 return(FALSE);
  2326.           }
  2327.          else
  2328.            if (hc)
  2329.             {
  2330.               /*
  2331.                  If no explicit year is given in actual date modifier
  2332.                    %0@<e|`dvar'>[[-]<n>[`ww[w]']] resp., %0*d|w<n>[`ww[w]'],
  2333.                    compute date respecting the displacement, which was returned
  2334.                    by function `rc_get_date()' in variable `hn' an `hwd'
  2335.               */
  2336.               if (hc == RC_EASTER_CHAR)
  2337.                {
  2338.                  if (!precomp_date (hn, hwd, &d, &m, y, EAster))
  2339.                    return(FALSE);
  2340.                }
  2341.               else
  2342.                 if (islower(hc))
  2343.                  {
  2344.                    if (!precomp_date (hn, hwd, &d, &m, y, DVar))
  2345.                      return(FALSE);
  2346.                  }
  2347.                 else
  2348.                   if (   hc == 'D'
  2349.                       || hc == 'W')
  2350.                    {
  2351.                      if (!precomp_nth_wd (hn, hwd, &n, &d, &m, &y, ((hc == 'D') ? DAy : WEek)))
  2352.                        return(FALSE);
  2353.                    }
  2354.                   else
  2355.                     return(FALSE);
  2356.             }
  2357.            else
  2358.              if (!d)
  2359.                d = act_day;
  2360.              else
  2361.                if (d == 99)
  2362.                 {
  2363.                   /*
  2364.                      Assume last day of month
  2365.                   */
  2366.                   if (m == 2)
  2367.                     d = days_of_february (y);
  2368.                   else
  2369.                     d = dvec[m-1];
  2370.                 }
  2371.          if (valid_date (d, m, y))
  2372.           {
  2373.             act_day = d;
  2374.             act_month = m;
  2375.             act_year = y;
  2376.           }
  2377.          else
  2378.            return(FALSE);
  2379.        }
  2380.       else
  2381.         return(FALSE);
  2382.     }
  2383. #endif /* USE_RC */
  2384.  
  2385.   return(TRUE);
  2386. }
  2387.  
  2388.  
  2389.  
  2390. #ifdef ANSI_PROTO
  2391. PUBLIC int
  2392. compare_d_m_name (const char       *s,
  2393.                   const Cmode_enum  mode)
  2394. #else /* !ANSI_PROTO */
  2395.    PUBLIC int
  2396. compare_d_m_name (s, mode)
  2397.    const char       *s;
  2398.    const Cmode_enum  mode;
  2399. #endif /* !ANSI_PROTO */
  2400. /*
  2401.    Compares given day/month name string `s' with built-in names and
  2402.      returns (1...7|12) either if `s' matches partitially (until `\0'
  2403.      or first digit found in `s') or `s' matches complete.
  2404.      If string doesn't match, function returns 0.
  2405.    Depending on mode:
  2406.      mode==DAy:
  2407.        Compares delivered day name `s' with the built-in day names
  2408.          and returns: 1...7 == dayname 1...7 found ; 0 otherwise
  2409.      mode==MOnth:
  2410.        Compares delivered month name `s' with the built-in month names
  2411.          and returns: 1...12 == monthname 1...12 found ; 0 otherwise
  2412. */
  2413. {
  2414.    register       int    len=(int)strlen(s);
  2415.    register       int    i=(mode==DAy) ? DAY_MIN : MONTH_MIN ;
  2416.    register       int    imax=(mode==DAy) ? DAY_MAX : MONTH_MAX;
  2417.    register       int    j;
  2418.    auto     const char  *ptr_char;
  2419.  
  2420.  
  2421.    if (len)
  2422.      for ( ; i <= imax ; i++)
  2423.       {
  2424.         ptr_char = (mode==DAy) ? day_name (i) : month_name (i);
  2425.         j = 0;
  2426.         while (   *(ptr_char + j)
  2427.                && s[j])
  2428. #if USE_EASC
  2429.           if (   (   (   s[j] == *AE
  2430.                       || s[j] == *AAE)
  2431.                   && (   *(ptr_char + j) == *AE
  2432.                       || *(ptr_char + j) == *AAE))
  2433.               || (   (   s[j] == *OE
  2434.                       || s[j] == *OOE)
  2435.                   && (   *(ptr_char + j) == *OE
  2436.                       || *(ptr_char + j) == *OOE))
  2437.               || (   (   s[j] == *UE
  2438.                       || s[j] == *UUE)
  2439.                   && (   *(ptr_char + j) == *UE
  2440.                       || *(ptr_char + j) == *UUE)))
  2441.             j++;
  2442.           else
  2443. #endif
  2444.             if (tolower(*(ptr_char+j)) == tolower(s[j]))
  2445.               j++;
  2446.             else
  2447.               break;
  2448.         if (   j == len
  2449.             || !*(ptr_char + j)
  2450.             || (   j
  2451.                 && isdigit(s[j])))
  2452.           return(i);
  2453.       }
  2454.  
  2455.    return(0);
  2456. }
  2457.  
  2458.  
  2459.  
  2460. #ifdef ANSI_PROTO
  2461. PUBLIC int
  2462. asc_sort (const char **a,
  2463.           const char **b)
  2464. #else /* !ANSI_PROTO */
  2465.    PUBLIC int
  2466. asc_sort (a, b)
  2467.    const char **a;
  2468.    const char **b;
  2469. #endif /* !ANSI_PROTO */
  2470. /*
  2471.    The (q)sort compare function; ascending order
  2472. */
  2473. {
  2474.    return(strcmp(*a, *b));
  2475. }
  2476.  
  2477.  
  2478.  
  2479. #ifdef ANSI_PROTO
  2480. PUBLIC int
  2481. des_sort (const char **a,
  2482.           const char **b)
  2483. #else /* !ANSI_PROTO */
  2484.    PUBLIC int
  2485. des_sort (a, b)
  2486.    const char **a;
  2487.    const char **b;
  2488. #endif /* !ANSI_PROTO */
  2489. /*
  2490.    The (q)sort compare function; descending order
  2491. */
  2492. {
  2493.    return(strcmp(*b, *a));
  2494. }
  2495.  
  2496.  
  2497.  
  2498. #ifdef ANSI_PROTO
  2499. PUBLIC Bool
  2500. is_presorted (char **table,
  2501.               int    elems)
  2502. #else /* !ANSI_PROTO */
  2503.    PUBLIC Bool
  2504. is_presorted (table, elems)
  2505.    char **table;
  2506.    int    elems;
  2507. #endif /* !ANSI_PROTO */
  2508. /*
  2509.    Checks whether the textual entries in `table' are presorted in
  2510.       ascending sort order.  returns TRUE if the entries in `table'
  2511.       are presorted, otherwise FALSE.
  2512. */
  2513. {
  2514.    if (--elems > 0)
  2515.     {
  2516.       register int  i=0;
  2517.       register int  j=0;
  2518.  
  2519.  
  2520.       while (elems--)
  2521.        {
  2522.          j++;
  2523.          if (strcmp(table[i], table[j]) > 0)
  2524.            return(FALSE);
  2525.          i++;
  2526.        }
  2527.     }
  2528.  
  2529.   return(TRUE);
  2530. }
  2531.  
  2532.  
  2533.  
  2534. #ifdef ANSI_PROTO
  2535. PUBLIC void
  2536. resort (      char **table,
  2537.         const int    elems)
  2538. #else /* !ANSI_PROTO */
  2539.    PUBLIC void
  2540. resort (table, elems)
  2541.    const char **table;
  2542.          int    elems;
  2543. #endif /* !ANSI_PROTO */
  2544. /*
  2545.    Rearranges (reverts) the sort order of the textual entries in `table' from
  2546.      ascending sort order to descending sort order by pointer swapping.
  2547. */
  2548. {
  2549.    register int  right=elems-1;
  2550.  
  2551.  
  2552.    if (right > 0)
  2553.     {
  2554.       register int    left=0;
  2555.       auto     char  *ptr_elem;
  2556.  
  2557.  
  2558.       while (left < right)
  2559.        {
  2560.          ptr_elem = table[left];
  2561.          table[left++] = table[right];
  2562.          table[right--] = ptr_elem;
  2563.        }
  2564.     }
  2565. }
  2566.  
  2567.  
  2568.  
  2569. #if !USE_GER
  2570. #  ifdef ANSI_PROTO
  2571. PUBLIC const char *
  2572. day_suffix (int day)
  2573. #  else /* !ANSI_PROTO */
  2574.    PUBLIC const char *
  2575. day_suffix (day)
  2576.    int day;
  2577. #  endif /* !ANSI_PROTO */
  2578. /*
  2579.    Returns the ordinal suffix (st, nd, rd or th) which is
  2580.      added to a single day number using the format %-3s
  2581. */
  2582. {
  2583.    static   const char  *suffix[]={"'th", "'st", "'nd", "'rd"};
  2584.    register       int    i=0;
  2585.  
  2586.  
  2587. /*
  2588.    Necessary for numbers > [9]9999
  2589.  
  2590.    if (day > 10000)
  2591.      day %= 10000;
  2592.    if (day > 1000)
  2593.      day %= 1000;
  2594. */
  2595.    if (day > 100)
  2596.      day %= 100;
  2597.    if (   day < 11
  2598.        || day > 13)
  2599.      i = day % 10;
  2600.    if (i > 3)
  2601.      i = 0;
  2602.  
  2603.    return(suffix[i]);
  2604. }
  2605.  
  2606.  
  2607.  
  2608. #  ifdef ANSI_PROTO
  2609. PUBLIC const char *
  2610. short3_day_name (const int day)
  2611. #  else /* !ANSI_PROTO */
  2612.    PUBLIC const char *
  2613. short3_day_name (day)
  2614.    const int day;
  2615. #  endif /* !ANSI_PROTO */
  2616. /*
  2617.    Returns the short name of the day using the format %-3s
  2618. */
  2619. {
  2620.    static const char  *name[]={
  2621.                                 "invalid day",
  2622.                                 "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"
  2623.                               };
  2624.  
  2625.  
  2626.    return(((day<DAY_MIN)||(day>DAY_MAX)) ? name[0] : name[day]);
  2627. }
  2628. #endif /* !USE_GER */
  2629.  
  2630.  
  2631.  
  2632. #ifdef ANSI_PROTO
  2633. PUBLIC const char *
  2634. short_day_name (const int day)
  2635. #else /* !ANSI_PROTO */
  2636.    PUBLIC const char *
  2637. short_day_name (day)
  2638.    const int day;
  2639. #endif /* !ANSI_PROTO */
  2640. /*
  2641.    Returns the short name of the day using the format %-2s
  2642. */
  2643. {
  2644. #if USE_GER
  2645.    static const char  *name[]={
  2646.                                 "ung"UE"ltiger Tag",
  2647.                                 "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"
  2648.                               };
  2649. #else /* !USE_GER */
  2650.    static const char  *name[]={
  2651.                                 "invalid day",
  2652.                                 "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"
  2653.                               };
  2654. #endif /* !USE_GER */
  2655.  
  2656.    return(((day<DAY_MIN)||(day>DAY_MAX)) ? name[0] : name[day]);
  2657. }
  2658.  
  2659.  
  2660.  
  2661. #ifdef ANSI_PROTO
  2662. PUBLIC const char *
  2663. day_name (const int day)
  2664. #else /* !ANSI_PROTO */
  2665.    PUBLIC const char *
  2666. day_name (day)
  2667.    const int day;
  2668. #endif /* !ANSI_PROTO */
  2669. /*
  2670.    Returns the complete name of the day
  2671. */
  2672. {
  2673. #if USE_GER
  2674.    static const char  *name[]={
  2675.                                 "ung"UE"ltiger Tag",
  2676.                                 "Montag",  "Dienstag", "Mittwoch", "Donnerstag",
  2677.                                 "Freitag", "Samstag",  "Sonntag"
  2678.                               };
  2679. #else /* !USE_GER */
  2680.    static const char  *name[]={
  2681.                                 "invalid day",
  2682.                                 "Monday", "Tuesday",  "Wednesday", "Thursday",
  2683.                                 "Friday", "Saturday", "Sunday"
  2684.                               };
  2685. #endif /* !USE_GER */
  2686.  
  2687.    return(((day<DAY_MIN)||(day>DAY_MAX)) ? name[0] : name[day]);
  2688. }
  2689.  
  2690.  
  2691.  
  2692. #ifdef ANSI_PROTO
  2693. PUBLIC const char *
  2694. short_month_name (const int month)
  2695. #else /* !ANSI_PROTO */
  2696.    PUBLIC const char *
  2697. short_month_name (month)
  2698.    const int month;
  2699. #endif /* !ANSI_PROTO */
  2700. /*
  2701.    Returns the short name of the month using the format %-3s
  2702. */
  2703. {
  2704. #if USE_GER
  2705.    static const char  *name[]={
  2706.                                 "ung"UE"ltiger Monat",
  2707.                                 "Jan", "Feb",
  2708. #  if USE_EASC
  2709.                                 "M"AE"r",
  2710. #  else /* !USE_EASC */
  2711.                                 "M"AE,
  2712. #  endif /* !USE_EASC */
  2713.                                 "Apr", "Mai", "Jun", "Jul", "Aug",
  2714.                                 "Sep", "Okt", "Nov", "Dez"
  2715.                               };
  2716. #else /* !USE_GER */
  2717.    static const char  *name[]={
  2718.                                 "invalid month",
  2719.                                 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  2720.                                 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
  2721.                               };
  2722. #endif /* !USE_GER */
  2723.  
  2724.    return(((month<MONTH_MIN)||(month>MONTH_MAX)) ? name[0] : name[month]);
  2725. }
  2726.  
  2727.  
  2728.  
  2729. #ifdef ANSI_PROTO
  2730. PUBLIC const char *
  2731. month_name (const int month)
  2732. #else /* !ANSI_PROTO */
  2733.    PUBLIC const char *
  2734. month_name (month)
  2735.    const int month;
  2736. #endif /* !ANSI_PROTO */
  2737. /*
  2738.    Returns the complete name of the month
  2739. */
  2740. {
  2741. #if USE_GER
  2742.    static const char  *name[]={
  2743.                                 "ung"UE"ltiger Monat",
  2744.                                 "Januar",  "Februar",  "M"AE"rz",
  2745.                                 "April",   "Mai",      "Juni",
  2746.                                 "Juli",    "August",   "September",
  2747.                                 "Oktober", "November", "Dezember"
  2748.                               };
  2749. #else /* !USE_GER */
  2750.    static const char  *name[]={
  2751.                                 "invalid month",
  2752.                                 "January", "February", "March",
  2753.                                 "April",   "May",      "June",
  2754.                                 "July",    "August",   "September",
  2755.                                 "October", "November", "December"
  2756.                               };
  2757. #endif /* !USE_GER */
  2758.  
  2759.    return(((month<MONTH_MIN)||(month>MONTH_MAX)) ? name[0] : name[month]);
  2760. }
  2761.  
  2762.  
  2763.  
  2764. #ifdef ANSI_PROTO
  2765. PUBLIC Ulint
  2766. date2num (const int day,
  2767.           const int month,
  2768.           const int year)
  2769. #else /* !ANSI_PROTO */
  2770.    PUBLIC Ulint
  2771. date2num (day, month, year)
  2772.    const int day;
  2773.    const int month;
  2774.    const int year;
  2775. #endif /* !ANSI_PROTO */
  2776. /*
  2777.    Computes the absolute number of days of delivered date since 00010101(==`yyyymmdd')
  2778.      respecting the missing period of the Gregorian reformation
  2779. */
  2780. {
  2781.    auto Ulint  julian_days=(Ulint)((year-1)*(Ulint)(DAY_LAST)+((year-1)>>2));
  2782.  
  2783.  
  2784.    if (   year > GREG_YEAR
  2785.        || (   (year == GREG_YEAR)
  2786.            && (   month > GREG_MONTH
  2787.                || (   (month == GREG_MONTH)
  2788.                    && (day > GREG_L_DAY)))))
  2789.      julian_days -= (Ulint)(GREG_L_DAY - GREG_F_DAY + 1);
  2790.    if (year > GREG_YEAR)
  2791.     {
  2792.       julian_days += (((year - 1) / 400) - (GREG_YEAR / 400));
  2793.       julian_days -= (((year - 1) / 100) - (GREG_YEAR / 100));
  2794.     }
  2795.    julian_days += (Ulint)mvec[month-1];
  2796.    julian_days += day;
  2797.    if (   (days_of_february (year) == 29)
  2798.        && (month > 2))
  2799.      julian_days++;
  2800.  
  2801.    return(julian_days);
  2802. }
  2803.  
  2804.  
  2805.  
  2806. #ifdef ANSI_PROTO
  2807. PUBLIC Bool
  2808. jdate2sdate (      int  jdate,
  2809.              const int  is_leap_year,
  2810.                    int *day,
  2811.                    int *month)
  2812. #else /* !ANSI_PROTO */
  2813.    PUBLIC Bool
  2814. jdate2sdate (jdate, is_leap_year, day, month)
  2815.          int  jdate;
  2816.    const int  is_leap_year;
  2817.          int *day;
  2818.          int *month;
  2819. #endif /* !ANSI_PROTO */
  2820. /*
  2821.    Converts a delivered Julian date of a year to a standard date
  2822.      (returned in &day and &month) and returns:
  2823.        TRUE in case julian date is valid;
  2824.        FALSE otherwise
  2825. */
  2826. {
  2827.    register       int   i;
  2828.    auto           Bool  decrement_date;
  2829.  
  2830.  
  2831.    if (   jdate > DAY_LAST+is_leap_year
  2832.        || jdate < DAY_MIN)
  2833.      return(FALSE);
  2834.    decrement_date = (Bool)(   is_leap_year
  2835.                            && (jdate > 59));
  2836.    if (decrement_date)
  2837.      jdate--;
  2838.    for (i=MONTH_MIN ; i < MONTH_MAX ; i++)
  2839.     {
  2840.       jdate -= dvec[i-1];
  2841.       if (jdate <= 0)
  2842.        {
  2843.          jdate += dvec[i-1];
  2844.          break;
  2845.        }
  2846.     }
  2847.    *month = i;
  2848.    *day = jdate;
  2849.    if (   decrement_date
  2850.        && (*month == 2)
  2851.        && (*day == 28))
  2852.      (*day)++;
  2853.  
  2854.    return(TRUE);
  2855.    /*
  2856.       Alternative floating-point algorithm for managing this stuff:
  2857.       ...
  2858.       if (jdate-is_leap_year > 59)
  2859.        {
  2860.          month = (int)((63 + jdate - is_leap_year) / 30.61) - 1;
  2861.          day = (int)(63 + jdate - is_leap_year - abs((int)((month + 1) * 30.61)));
  2862.        }
  2863.       else
  2864.        {
  2865.          month = (int)((428 + jdate) / 30.61) - 13;
  2866.          day = (int)(428 + jdate - abs((int)((month + 13) * 30.61)));
  2867.        }
  2868.       ...
  2869.    */
  2870. }
  2871.  
  2872.  
  2873.  
  2874. #ifdef ANSI_PROTO
  2875. PUBLIC int
  2876. weekday_of_date (const int day,
  2877.                  const int month,
  2878.                  const int year)
  2879. #else /* !ANSI_PROTO */
  2880.    PUBLIC int
  2881. weekday_of_date (day, month, year)
  2882.    const int day;
  2883.    const int month;
  2884.    const int year;
  2885. #endif /* !ANSI_PROTO */
  2886. /*
  2887.    Computes the weekday of a Gregorian/Julian date (month must be 1...12)
  2888.      and returns 1...7 ; 1==mo, 2==tu...7==su
  2889. */
  2890. {
  2891.    auto Ulint  julian_days=date2num (day, month, year)%DAY_MAX;
  2892.  
  2893.    return((julian_days>2) ? (int)(julian_days-2) : (int)(julian_days+5));
  2894. }
  2895.  
  2896.  
  2897.  
  2898. #ifdef ANSI_PROTO
  2899. PUBLIC int
  2900. day_of_year (const int day,
  2901.              const int month,
  2902.              const int year)
  2903. #else /* !ANSI_PROTO */
  2904.    PUBLIC int
  2905. day_of_year (day, month, year)
  2906.    const int day;
  2907.    const int month;
  2908.    const int year;
  2909. #endif /* !ANSI_PROTO */
  2910. /*
  2911.    Computes the day of the year of a Gregorian/Julian date (month must be 1...12)
  2912.      and returns the 1...365|366
  2913. */
  2914. {
  2915.    register int  i;
  2916.  
  2917.  
  2918.    if (month < 3)
  2919.      i = mvec[month-1] + day;
  2920.    else
  2921.      i = mvec[month-1] + day + (days_of_february (year) == 29);
  2922.    if (   (year == GREG_YEAR)
  2923.        && (   month > GREG_MONTH
  2924.            || (   (month == GREG_MONTH)
  2925.                && (day > GREG_L_DAY))))
  2926.      i -= (GREG_L_DAY - GREG_F_DAY + 1);
  2927.  
  2928.    return(i);
  2929. }
  2930.  
  2931.  
  2932.  
  2933. #ifdef ANSI_PROTO
  2934. PUBLIC int
  2935. days_of_february (const int year)
  2936. #else /* !ANSI_PROTO */
  2937.    PUBLIC int
  2938. days_of_february (year)
  2939.    const int year;
  2940. #endif /* !ANSI_PROTO */
  2941. /*
  2942.    Computes the number of days in february and returns them
  2943. */
  2944. {
  2945.    return((year>GREG_YEAR)
  2946.           ? (year&3) ? 28 : ((!(year%100)&&(year%400)) ? 28 : 29)
  2947.           : (year&3) ? 28 : 29);
  2948. }
  2949.  
  2950.  
  2951.  
  2952. #ifdef ANSI_PROTO
  2953. PUBLIC Bool
  2954. valid_date (const int day,
  2955.             const int month,
  2956.             const int year)
  2957. #else /* !ANSI_PROTO */
  2958.    PUBLIC Bool
  2959. valid_date (day, month, year)
  2960.    const int day;
  2961.    const int month;
  2962.    const int year;
  2963. #endif /* !ANSI_PROTO */
  2964. /*
  2965.    Checks whether a delivered date is valid
  2966. */
  2967. {
  2968.    if (   day < 0
  2969.        || month < MONTH_MIN
  2970.        || month > MONTH_MAX
  2971.        || (   (month != 2)
  2972.            && (day > dvec[month-1]))
  2973.        || (   (month == 2)
  2974.            && (day > days_of_february (year))))
  2975.      return(FALSE);
  2976.  
  2977.    return(TRUE);
  2978. }
  2979.  
  2980.  
  2981.  
  2982. #ifdef ANSI_PROTO
  2983. PUBLIC int
  2984. week_number (const int day,
  2985.              const int month,
  2986.              const int year)
  2987. #else /* !ANSI_PROTO */
  2988.    PUBLIC int
  2989. week_number (day, month, year)
  2990.    const int day;
  2991.    const int month;
  2992.    const int year;
  2993. #endif /* !ANSI_PROTO */
  2994. /*
  2995.    Returns the real ISO-8601:1988 standard week number of delivered date,
  2996.      0 in case date occurs both in last week of previous year and
  2997.      first week of year (week starts with monday(1) and ends with sunday(7))
  2998. */
  2999. {
  3000.    register int  i=raw_week_number (day, month, year);
  3001.    register int  j;
  3002.    register int  wmax=WEEK_MAX;
  3003.  
  3004.  
  3005.    if (year == GREG_YEAR)
  3006.      wmax = ((DAY_LAST + (days_of_february (GREG_YEAR) == 29)
  3007.             - (GREG_L_DAY - GREG_F_DAY + 1)) / DAY_MAX) + 1;
  3008.    if (i == wmax+1)
  3009.     {
  3010.       if (month == MONTH_MIN)
  3011.        {
  3012.          j = raw_week_number (dvec[MONTH_MAX-1], MONTH_MAX, year-1);
  3013.          if (i != j)
  3014.            i = 0;
  3015.        }
  3016.       else
  3017.        {
  3018.          j = raw_week_number (DAY_MIN, MONTH_MIN, year+1);
  3019.          if (i != j)
  3020.            i = 0;
  3021.        }
  3022.     }
  3023.    else
  3024.      if (i == 1)
  3025.       {
  3026.         if (weekday_of_date (DAY_MIN, MONTH_MIN, year) <= 4)
  3027.          {
  3028.            j = raw_week_number (dvec[MONTH_MAX-1], MONTH_MAX, year-1);
  3029.            if (year-1 == GREG_YEAR)
  3030.              wmax = ((DAY_LAST + (days_of_february (GREG_YEAR) == 29)
  3031.                     - (GREG_L_DAY - GREG_F_DAY + 1)) / DAY_MAX) + 1;
  3032.            if (   (j != wmax)
  3033.                && (year != GREG_YEAR))
  3034.              i = 0;
  3035.          }
  3036.       }
  3037.  
  3038.    return(i);
  3039. }
  3040.  
  3041.  
  3042.  
  3043. #ifdef ANSI_PROTO
  3044. PUBLIC int
  3045. weekno2jday (      int week,
  3046.              const int year)
  3047. #else /* !ANSI_PROTO */
  3048.    PUBLIC int
  3049. weekno2jday (week, year)
  3050.          int week;
  3051.    const int year;
  3052. #endif /* !ANSI_PROTO */
  3053. /*
  3054.    Returns that day number of (Julian or Gregorian)year, the delivered
  3055.    ISO-8601:1988 week number starts at.
  3056.      week number may be:
  3057.        (a)  0           == returns jdate of first week of year resp.,
  3058.                              that dates, which occur both in last week of
  3059.                              previous year and first week of year
  3060.                              (in this case, the function return value is -5...0)
  3061.        (b)  1...52      == returns jdate always
  3062.        (c) 53           == returns jdate or if year owns NO 53'rd week,
  3063.                              returns -WEEK_MAX [=special value])
  3064.        (d) 99           == returns jdate of last week of year
  3065.      range of return value is:
  3066.            -5...0       == in case event (a) has occured and the first days
  3067.                              of year occur both in last week of previous year
  3068.                              and first week of year
  3069.             1...365|366 == events (b), (c) and (d)
  3070. */
  3071. {
  3072.    register int  wd=weekday_of_date (DAY_MIN, MONTH_MIN, year);
  3073.    register int  ww=week_number (DAY_MIN, MONTH_MIN, year);
  3074.    register int  wm=week_number (dvec[MONTH_MAX-1], MONTH_MAX, year);
  3075.    register int  wmax=WEEK_MAX;
  3076.    register int  i=1;
  3077.  
  3078.  
  3079.    if (year == GREG_YEAR)
  3080.      wmax = ((DAY_LAST + (days_of_february (GREG_YEAR) == 29)
  3081.             - (GREG_L_DAY - GREG_F_DAY + 1)) / DAY_MAX) + 1;
  3082.    if (ww > 1)
  3083.      i += (DAY_MAX - wd + 1);
  3084.    else
  3085.      if (!ww)
  3086.        i -= (wd - 1);
  3087.    if (   wm
  3088.        && (wm != wmax+1)
  3089.        && (week == wmax+1))
  3090.      return(-WEEK_MAX);
  3091.    else
  3092.      if (week == 99)
  3093.       {
  3094.         week = wm;
  3095.         if (!wm)
  3096.           week = wmax + 1;
  3097.         i += ((week - 1) * DAY_MAX);
  3098.       }
  3099.      else
  3100.       {
  3101.         i += ((week - 1) * DAY_MAX);
  3102.         if (   !week
  3103.             && (i <= -(DAY_MAX-1)))
  3104.           i += DAY_MAX;
  3105.       }
  3106.    if (year == GREG_YEAR)
  3107.      if (i >= day_of_year (GREG_L_DAY+1, GREG_MONTH, GREG_YEAR))
  3108.        i += (GREG_L_DAY - GREG_F_DAY + 1);
  3109.    if (i > DAY_LAST+(days_of_february (year)==29))
  3110.      return(-WEEK_MAX);
  3111.  
  3112.    return(i);
  3113. }
  3114.  
  3115.  
  3116.  
  3117. #ifdef ANSI_PROTO
  3118. PUBLIC int
  3119. knuth_easter_formula (const int year)
  3120. #else /* !ANSI_PROTO */
  3121.    PUBLIC int
  3122. knuth_easter_formula (year)
  3123.    const int year;
  3124. #endif /* !ANSI_PROTO */
  3125. /*
  3126.    This procedure calculates the day and month of Easter giving the year.
  3127.    It returns the "actual day_of_year date" of Western Eastern (not the
  3128.    Eastern Easter of the Eastern Orthodox churches) after A.D.463.
  3129.    `golden_number' is the number of the year in the Metonic cycle, used
  3130.    to determine the position of the calendar moon.
  3131.    `gregorian_correction' is the number of preceding years like 1700, 1800,
  3132.    1900 when leap year was not held.
  3133.    `clavian_correction' is a correction for the Metonic cycle of about
  3134.    8 days every 2500 years.
  3135.    `epact' is the age of the calendar moon at the beginning of the year.
  3136.    `extra_days' specifies when Sunday occurs in March. `epact' specifies
  3137.    when full moon occurs. Easter is the first Sunday following the first
  3138.    full moon which occus on or after March 21. (Ref.: De Morgan, A Budget
  3139.    of Paradoxes)
  3140.    This Algorithm was given by Don Knuth in CACM 5(1962), 209-210.
  3141. */
  3142. {
  3143.    register int  golden_number;
  3144.    register int  century;
  3145.    register int  gregorian_correction;
  3146.    register int  clavian_correction;
  3147.    register int  extra_days;
  3148.    register int  epact;
  3149.    register int  day;
  3150.    register int  month;
  3151.  
  3152.  
  3153.    golden_number = (year % 19) + 1;
  3154.    if (year <= GREG_REFORM)
  3155.     {
  3156.       /*
  3157.          Computation for Julian years
  3158.       */
  3159.       extra_days = (5 * year) / 4;
  3160.       epact = ((11 * golden_number - 4) % 30) + 1;
  3161.     }
  3162.    else
  3163.     {
  3164.       /*
  3165.          Computation for Gregorian years
  3166.       */
  3167.       century = year / 100 + 1;
  3168.       gregorian_correction = (3 * century) / 4 - 12;
  3169. /*
  3170.       clavian_correction = (century - 16 - (century - 18) / 25) / 3;
  3171. */
  3172.       clavian_correction = ((8 * century + 5) / 25) - 5;
  3173.       extra_days = (5 * year) / 4 - gregorian_correction - 10;
  3174.       epact = (11 * golden_number + 20 + clavian_correction - gregorian_correction) % 30;
  3175.       if (epact <= 0)
  3176.         epact += 30;
  3177.       if (   (   (epact == 25)
  3178.               && (golden_number > 11))
  3179.           || epact == 24)
  3180.         epact++;
  3181.     }
  3182.    day = 44 - epact;
  3183.    if (day < 21)
  3184.      day += 30;
  3185.    day += 7 - ((extra_days + day) % 7);
  3186.    if (day > 31)
  3187.     {
  3188.       day -= 31;
  3189.       month = 4;
  3190.     }
  3191.    else
  3192.      month = 3;
  3193.  
  3194.    return(day_of_year (day, month, year));
  3195. }
  3196.  
  3197.  
  3198.  
  3199. #ifdef ANSI_PROTO
  3200. PUBLIC int
  3201. julian_gregor_diff (const int day,
  3202.                     const int month,
  3203.                     const int year)
  3204. #else /* !ANSI_PROTO */
  3205.    PUBLIC int
  3206. julian_gregor_diff (day, month, year)
  3207.    const int day;
  3208.    const int month;
  3209.    const int year;
  3210. #endif /* !ANSI_PROTO */
  3211. /*
  3212.    Returns the day difference between given Gregorian date
  3213.      and according Julian date, i.e. the amount of days,
  3214.      the Julian calendar is past the Gregorian calendar.
  3215. */
  3216. {
  3217.    auto Ulint  julian_days=(Ulint)((year-1)*(Ulint)(DAY_LAST)+((year-1)>>2));
  3218.  
  3219.  
  3220.    julian_days += (Ulint)(mvec[month-1] + day);
  3221.    if (   !(year & 3)
  3222.        && (month > 2))
  3223.      julian_days++;
  3224.  
  3225.    return((int)(julian_days-date2num (day, month, year)));
  3226. }
  3227.  
  3228.  
  3229.  
  3230. #ifdef ANSI_PROTO
  3231. PUBLIC const char *
  3232. usage_msg (void)
  3233. #else /* !ANSI_PROTO */
  3234.    PUBLIC const char *
  3235. usage_msg (void)
  3236. #endif /* !ANSI_PROTO */
  3237. /*
  3238.    Copies the constructed preprocessor text `USAGE_MSG'
  3239.      to usage text `usage_txt' and includes the actual program name
  3240. */
  3241. {
  3242.    static char  *usg_txt;
  3243.    static Bool   is_initialized=FALSE;
  3244.  
  3245.  
  3246.    if (!is_initialized)
  3247.     {
  3248.       usg_txt = (char *)my_malloc (strlen(USAGE_MSG)-2+len_prgr_name+1,
  3249.                                    124, __FILE__, __LINE__ -1,
  3250.                                    "usg_txt", 0);
  3251.       sprintf(usg_txt, USAGE_MSG, prgr_name);
  3252.       is_initialized = TRUE;
  3253.     }
  3254.  
  3255.    return(usg_txt);
  3256. }
  3257.  
  3258.  
  3259.  
  3260. #ifdef ANSI_PROTO
  3261. PUBLIC void
  3262. put_longopt_description (FILE *fp)
  3263. #else /* !ANSI_PROTO */
  3264.    PUBLIC void
  3265. put_longopt_description (fp)
  3266.    FILE *fp;
  3267. #endif /* !ANSI_PROTO */
  3268. /*
  3269.    Puts a description text of long options to file `fp'
  3270. */
  3271. {
  3272. #if USE_GER
  3273.    fprintf(fp, "Versuche `%s %s' oder ",
  3274.            prgr_name, get_longopt_description (SYM_HELP, TRUE));
  3275.    fprintf(fp, "`%s %s' f"UE"r mehr Information.",
  3276.            prgr_name, get_longopt_description (SYM_LONG_HELP2, TRUE));
  3277. #else /* !USE_GER */
  3278.    fprintf(fp, "Try `%s %s' or ",
  3279.            prgr_name, get_longopt_description (SYM_HELP, TRUE));
  3280.    fprintf(fp, "`%s %s' for more information.",
  3281.            prgr_name, get_longopt_description (SYM_LONG_HELP2, TRUE));
  3282. #endif /* !USE_GER */
  3283. }
  3284.  
  3285.  
  3286.  
  3287. #ifdef ANSI_PROTO
  3288. LOCAL const char *
  3289. get_longopt_description (const int  longopt_symbolic,
  3290.                          const Bool with_larglist)
  3291. #else /* !ANSI_PROTO */
  3292.    LOCAL const char *
  3293. get_longopt_description (longopt_symbolic, with_larglist)
  3294.    const int  longopt_symbolic;
  3295.    const Bool with_larglist;
  3296. #endif /* !ANSI_PROTO */
  3297. /*
  3298.    Returns a description text of given `longopt_symbolic' long option in global
  3299.      text buffer `s2'.  If `with_larglist' is TRUE, the returned description
  3300.      text contains the argument list text (if any) too, otherwise the returned
  3301.      description text contains the complete name of the long option only!
  3302. */
  3303. {
  3304.    auto     const Lopt_struct  *ptr_lopt=&lopt[0];
  3305.    register       int           i;
  3306.  
  3307.  
  3308.    while (   (ptr_lopt->symbolic_name != longopt_symbolic)
  3309.           && (ptr_lopt->long_name != NULL))
  3310.      ptr_lopt++;
  3311.    if (ptr_lopt->long_name != NULL)
  3312.     {
  3313.       i = 0;
  3314.       sprintf(s2, SWITCH""SWITCH"%s", ptr_lopt->long_name);
  3315.       if (   with_larglist
  3316.           && (ptr_lopt->larg_mode != LARG_NO))
  3317.        {
  3318.          if (ptr_lopt->larg_mode == LARG_NO_OR_ONE)
  3319.           {
  3320.             strcat(s2, "[");
  3321.             strcat(s2, LARG_SEP);
  3322.           }
  3323.          else
  3324.            strcat(s2, LARG_SEP);
  3325.          if (   (ptr_lopt->larg_mode == LARG_ONE)
  3326.              && (ptr_lopt->largs[0] == NULL))
  3327.            strcat(s2, LARG_TXT);
  3328.          else
  3329.           {
  3330.             if (ptr_lopt->largs[0] == NULL)
  3331.               strcat(s2, LARG_TXT);
  3332.             else
  3333.               while (ptr_lopt->largs[i] != NULL)
  3334.                {
  3335.                  strcat(s2, ptr_lopt->largs[i]);
  3336.                  if (ptr_lopt->largs[i+1] != NULL)
  3337.                    strcat(s2, "|");
  3338.                  i++;
  3339.                }
  3340.           }
  3341.          if (ptr_lopt->larg_mode == LARG_NO_OR_ONE)
  3342.            strcat(s2, "]");
  3343.        }
  3344.     }
  3345.    else
  3346.      *s2 = '\0';
  3347.  
  3348.    return(s2);
  3349. }
  3350.  
  3351.  
  3352.  
  3353. #ifdef ANSI_PROTO
  3354. LOCAL void
  3355. my_copyright (      FILE *fp,
  3356.               const char *prgr_id)
  3357. #else /* !ANSI_PROTO */
  3358.    LOCAL void
  3359. my_help_head_txt (fp, prgr_id)
  3360.          FILE *fp;
  3361.    const char *prgr_id;
  3362. #endif /* !ANSI_PROTO */
  3363. /*
  3364.    Prints the id and copyright text to file `fp' using the central output
  3365.      function `print_text()' and uses global text buffer `s' internally.
  3366. */
  3367. {
  3368.    strcpy(s, prgr_id);
  3369.    print_text (fp, s, INternal);
  3370.    print_text (fp, s, INternal);
  3371.    strcpy(s, "   "COPYRIGHT_TXT);
  3372.    print_text (fp, s, INternal);
  3373.    print_text (fp, s, INternal);
  3374. }
  3375.  
  3376.  
  3377.  
  3378. #ifdef ANSI_PROTO
  3379. LOCAL void
  3380. my_help_head_txt (FILE *fp)
  3381. #else /* !ANSI_PROTO */
  3382.    LOCAL void
  3383. my_help_head_txt (fp)
  3384.    FILE *fp;
  3385. #endif /* !ANSI_PROTO */
  3386. /*
  3387.    Prints the help header text to file `fp' using the central
  3388.      output function `print_text()' and uses global text buffer
  3389.      `s' and `s2' internally.
  3390. */
  3391. {
  3392.    auto Bool  print_hls=(Bool)(is_tty&&highlight_flag&&!emu_hls);
  3393.  
  3394.  
  3395.    *s = '\0';
  3396.    if (print_hls)
  3397.      strcpy(s, ehls2s.seq);
  3398.    strcat(s, prgr_name);
  3399.    if (print_hls)
  3400.      strcat(s, ehls2e.seq);
  3401. #if USE_GER
  3402.    sprintf(s2, ":%*s Das GNU Kalenderprogramm  (", 6-len_prgr_name, "");
  3403. #else /* !USE_GER */
  3404.    sprintf(s2, ":%*s The GNU calendar program  (", 6-len_prgr_name, "");
  3405. #endif /* !USE_GER */
  3406.    strcat(s, s2);
  3407.    if (print_hls)
  3408.      strcat(s, ehls2s.seq);
  3409.    strcat(s, VERSION_NO);
  3410.    if (print_hls)
  3411.      strcat(s, ehls2e.seq);
  3412.    strcat(s, ")  "COPYRIGHT_TXT);
  3413.    print_text (fp, s, INternal);
  3414.    print_text (fp, s, INternal);
  3415.    strcpy(s, usage_msg ());
  3416.    print_text (fp, s, INternal);
  3417.    print_text (fp, s, INternal);
  3418. }
  3419.  
  3420.  
  3421.  
  3422. #ifdef ANSI_PROTO
  3423. LOCAL void
  3424. my_help_tail_txt (FILE *fp)
  3425. #else /* !ANSI_PROTO */
  3426.    LOCAL void
  3427. my_help_tail_txt (fp)
  3428.    FILE *fp;
  3429. #endif /* !ANSI_PROTO */
  3430. /*
  3431.    Prints the help tail text to file `fp' using the central
  3432.      output function `print_text()' and uses global text buffer
  3433.      `s' internally.
  3434. */
  3435. {
  3436.    auto Bool  print_hls=(Bool)(is_tty&&highlight_flag&&!emu_hls);
  3437.  
  3438.  
  3439.    print_text (fp, s, INternal);
  3440.    print_text (fp, s, INternal);
  3441. #if USE_GER
  3442.    sprintf(s, "`%s' ist `freie Software'     %*s", prgr_name, 6-len_prgr_name, "");
  3443. #else /* !USE_GER */
  3444.    sprintf(s, "`%s' is `free software'       %*s", prgr_name, 6-len_prgr_name, "");
  3445. #endif /* !USE_GER */
  3446.    if (print_hls)
  3447.      strcat(s, ehls2s.seq);
  3448.    strcat(s, "\\\\\\_''/'");
  3449.    if (print_hls)
  3450.      strcat(s, ehls2e.seq);
  3451. #if USE_GER
  3452. #  if USE_EASC
  3453.    strcat(s, " ");
  3454. #  endif
  3455.    strcat(s, "          Viel Spa"SZ" damit   =8^)");
  3456. #else /* !USE_GER */
  3457.    strcat(s, "                  Have fun   =8^)");
  3458. #endif /* !USE_GER */
  3459.    print_text (fp, s, INternal);
  3460.    if (print_hls)
  3461.      strcpy(s, ehls2s.seq);
  3462.    strcat(s, "---------------------------oOO    (/o-o\\) "
  3463.           "   OOo---------------------------");
  3464.    if (print_hls)
  3465.      strcat(s, ehls2e.seq);
  3466.    print_text (fp, s, INternal);
  3467.    if (print_hls)
  3468.      strcpy(s, ehls2s.seq);
  3469.    strcat(s, "  Thomas Esken                o  (.  \"  .)"
  3470.           "  o   Internet :                 ");
  3471.    if (print_hls)
  3472.      strcat(s, ehls2e.seq);
  3473.    print_text (fp, s, INternal);
  3474.    if (print_hls)
  3475.      strcpy(s, ehls2s.seq);
  3476.    strcat(s, "  Im Hagenfeld 84              \\___) ~ (__"
  3477.           "_/      <esken@uni-muenster.de>  ");
  3478.    if (print_hls)
  3479.      strcat(s, ehls2e.seq);
  3480.    print_text (fp, s, INternal);
  3481.    if (print_hls)
  3482.      strcpy(s, ehls2s.seq);
  3483.    strcat(s, "  D-48147 M\"unster; GERMANY               "
  3484.           "      Phone : (+49) 0251 232585  ");
  3485.    if (print_hls)
  3486.      strcat(s, ehls2e.seq);
  3487.    print_text (fp, s, INternal);
  3488. }
  3489.  
  3490.  
  3491.  
  3492. #ifdef ANSI_PROTO
  3493. LOCAL int
  3494. raw_week_number (const int day,
  3495.                  const int month,
  3496.                  const int year)
  3497. #else /* !ANSI_PROTO */
  3498.    LOCAL int
  3499. raw_week_number (day, month, year)
  3500.    const int day;
  3501.    const int month;
  3502.    const int year;
  3503. #endif /* !ANSI_PROTO */
  3504. /*
  3505.    Returns the raw ISO-8601:1988 standard week number of delivered date ONLY
  3506.      (week starts with monday(1) and ends with sunday(7))
  3507. */
  3508. {
  3509.    register int  jd=day_of_year (day, month, year);
  3510.    register int  sd=weekday_of_date (DAY_MIN, MONTH_MIN, year);
  3511.    register int  ww;
  3512.  
  3513.  
  3514.    /*
  3515.       Correct the computed Julian day of year number of delivered date
  3516.    */
  3517.    if (sd > 4)
  3518.      /*
  3519.         Starting day of year is friday...sunday
  3520.      */
  3521.      jd -= ((DAY_MAX - sd) + 1);
  3522.    else
  3523.      /*
  3524.         Starting day of year is monday...thursday
  3525.      */
  3526.      jd += (sd - 1);
  3527.    /*
  3528.       Compute week number of delivered date
  3529.    */
  3530.    if (jd > 0)
  3531.      /*
  3532.         Date has consecutive week number of current year:
  3533.           compute it
  3534.      */
  3535.      ww = (jd - 1) / DAY_MAX + 1;
  3536.    else
  3537.      /*
  3538.         Date has week number of last week of previous year:
  3539.           detect that week number by calling this function recursivly  ;)
  3540.      */
  3541.      ww = raw_week_number (dvec[MONTH_MAX-1], MONTH_MAX, year-1);
  3542.  
  3543.    return (ww);
  3544. }
  3545.